#include <iostream>
#include <string.h>
#define MAX 20000
using namespace std;

int main()
{
    int l,i,j,n;
    char s[MAX];
    gets(s);
    j=n=strlen(s)-1;
    while (s[i]==s[j] && i<n/2)
    {
        i++;
        j--;
    }
    l=j-i;
    cout << l;
    return 0;
}