#include using namespace std; template T gcd(T x, T y) { if (y == 0) return x; return gcd(y, x % y); } template T lcm(T x, T y) { if (x == 0 || y == 0) return 0; return x / gcd(x, y) * y; } int main() { string s; cin >> s; int n = s.size(); int ans = 1; for (int i = 0; i < n; i++) { for (int j = n - 1; j > i; j--) { if (s[i] != s[j]) continue; int cnt = 0; int l = i, r = j; while (l <= r) { if (s[l] == s[r]) cnt += (l == r ? 1 : 2); l++; r--; } ans = max(ans, cnt); } } cout << ans << endl; }