#include #include #include #include #include using namespace std; bool is_roop(vector s, int left, int tail) { while (left < tail) { if (s[left] != s[tail]) return false; left++; tail--; } return true; } int main(void) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed; vector s; int ans = 1; char c; while (cin >> c) s.push_back(c); int tail = s.size() - 1; for (int left = 0; left < tail; left++) { int right = tail; while (left < right) { if (s[left] == s[right]) { if (is_roop(s, left, right)) ans = max(ans, right - left + 1); } right--; } } if (ans == s.size()) ans -= 2; cout << ((ans == 0) ? 1 : ans) << endl; }