#include <bits/stdc++.h>

#define IOS {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}

using namespace std;

string t;

void solve()
{
    cin >> t ;

    int n = t.length() ;
    int l = 0 ;
    int r = n-1 ;
    int br = 0 , res = 0 ;

    while(l<r)
    {
        if(t[l] != t[r])
        {
            res = n - br*2 - 1 ;
            break;
        }
        l++;
        r--;
        br++;
    }

    if(res == 0)res = 1 ;

    cout << res << endl ;
}

int main()
{
    IOS ;

    solve() ;
}