#include<stdio.h>
#include<string.h>
#include<stdbool.h>
 

bool Pal(char *str)
{
    int len = strlen(str);

    if (len == 1)
        return true;
 

    char *ptr1 = str;
 

    char *ptr2 = str+len-1;
 
    while (ptr2 > ptr1)
    {
        if (*ptr2 != *ptr1)
            return false;
        ptr2--;
        ptr1++;
    }
    
    return true;
}
 

int brPromena(char t[])
{
    if (Pal(t))
        return 0;
        
    t++;
 
    return 1 + brPromena(t);
}
 

int main()
{
    char t[10000];
    
    scanf("%s", t);
    
    if (Pal(t) == true) printf("1\n");
    
    else printf("%d\n", brPromena(t));
    return 0;
}