#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; bool check(const string& str){ rep(i,str.length()){ if(str[i] != str[str.length()-1-i]) return false; } return true; } int main(){ string S; cin >> S; int mx = 0; rep(i,S.length()){ REP(j,i,S.length()){ if(check(S.substr(i, j-i+1))){ if(j-i+1 == S.length()) continue; mx = max(mx, j-i+1); } } } cout << mx << endl; return 0; }