#include <stdio.h>
#include <stdlib.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;
        ptr1++;
        ptr2--;
    }

    return true;
}

int saf(char t[])
{
    if (pal(t))
        return 0;

    t++;

    return 1 + saf(t);
}
int main()
{
    char t[20000];

    scanf("%s", t);

    if (pal(t) == true) printf("1\n");

    else printf("%d\n", saf(t));
    return 0;
}