#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { string S; cin >> S; int n = S.length(); int ans = 0; for ( int i = 0; i < n; i++ ) { for ( int j = 1; i+j-1 < n; j++ ) { string s = S.substr( i, j ); string t = s; reverse( t.begin(), t.end() ); if ( s == t && j != n ) { ans = max( ans, j ); } } } cout << ans << endl; return 0; }