#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; 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))) { cout << i << endl; return 0; } } } cout << 0 << endl; }