#include<stdio.h>
 
int main()
{
	char s[100];
    int k,i=0,count=0,n=0;
    scanf("%s",s);
    while(s[i] != '\0')
    {
    	n++;
    	i++;
    }
    for(i=1;i<n;i++)
    {
    	if(s[i-1]==s[i])
        {
        	count++;
        }
    }
    count=count*k;
    if(s[0]==s[k-1])
    {
    	count=count+k-1;
    }
    printf("%d",count);
}
