#include<iostream> #include<string> #include<algorithm> using namespace std; int main () { string s; while (cin >> s) { int ans = 1; int len = s.size(); for(int i = 0; i < len; ++i) { for (int j = len - 1; j > i; --j) { string temp = s.substr(i, j - i + 1); string tempR = temp; reverse(tempR.begin(), tempR.end()); if (temp == tempR && temp.size() > ans) ans = temp.size(); } } cout << ans << endl; } return 0; }