#include using namespace std; int main() { string s; cin >> s; auto r = s; reverse(r.begin(), r.end()); const int n = s.size(); int res = 0; for (int i = 0; i < n; ++i) { for (int j = 1; i + j <= n && j < n; ++j) { string ss = s.substr(i, j), rr = ss; reverse(rr.begin(), rr.end()); if (ss == rr) res = max(res, j); } } cout << res << endl; }