#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int i = 0;
    int j = s.size() - 1;
    while(i != j)
    {
        if(s[i] == s[j])
        {
            i++;
            j--;
        }
        else
        {
            cout << j - i << endl;
            break;
        }
    }
    if(i == j)
        cout << 1 << endl;

    
    return 0;
}