#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; int slng, ans; bool calc(string s) { int len = s.length(); FOR (i,0,len/2) { if (s[i] != s[len-1-i]) { return false; } } return true; } void dfs(string s, int MAX) { if(s[0] == 'a') { if (MAX != slng) ans = max(ans, MAX); return; } FOR(i,0,s.length()){ if(calc(s.substr(0,i+1))){ dfs(s.substr(i+1), max(MAX, i+1)); } } return; } int main(){ string s; cin >> s; slng = s.length(); s += 'a'; ans = 0; dfs(s,0); cout << ans << endl; return 0; }