#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s;
    cin>>s;
    int l=0,d=s.size()-1,r=1;
    while(l<d)
    {
        if(s[l]!=s[d])
        {
            r=d-l;
            break;
        }
        l++;
        d--;
    }
    cout<<r;
    return 0;
}