#!/usr/bin/perl

use v5.30;
use strict;

chomp (my $data = <>);

my $l = length $data;
$l /= 2;
$data .= substr($data, 0, $l);
$l--;
my $sum = 0;
$sum += $1 while $data =~ /(.)(?=.{$l}\1)/g;
say $sum;
