#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; bool f(string str) { string rs = str; reverse(rs.begin(), rs.end()); return str == rs; } int g(string str) { int n = str.size(); int i = 0; int j = n - 1; int len = n; while (i < j) { if (str[i] != str[j]) { str[i] = '#'; str[j] = '#'; len -= 2; } ++i; --j; } if (f(str)) { return len; } else { return 0; } } int main() { string S; cin >> S; int N = S.size(); int ans = 0; for (int l = 1; l <= N; ++l) { for (int i = 0; i <= N - l; ++i) { string str = S.substr(i, l); if (f(str)) { ans = l; } ans = max(ans, g(str)); } } cout << ans << endl; return 0; }