#include using namespace std; bool is_palindrome(string s) { for (size_t i = 0; i < s.size() / 2; i++) { if (s[i] != s[s.size() - i - 1]) return false; } return true; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin >> S; int res = 0; for (int i = 0; i < (int)S.size(); i++) { for (int j = 1; j < (int)S.size() - i + 1; j++) { auto T = S.substr(i, j); if (is_palindrome(T) && j != (int)S.size()) res = max(res, j); } } cout << res << '\n'; return 0; }