#!/usr/bin/perl

use v5.30;
use strict;

chomp (my $data = <>);

$data =~s /\A(.)(.*)\z/\1\2\1/;
my $sum = 0;
$sum += $1 while $data =~ /(.)(?=\1)/g;
say $sum;
