#include using namespace std; string S; bool is_palindrome(string a) { int n = a.size(); for (int i = 0; i < n / 2; ++i) if (a[i] != a[n - i - 1]) return false; return true; } int main() { cin >> S; int ma = 0; for (int i = S.size() - 1; i >= 1; --i) { for (int j = 0; j + i <= S.size(); ++j) { if (is_palindrome(S.substr(j, i))) { ma = max(ma, i); break; } } } cout << ma << endl; }