#include #include #include #include using namespace std; int main() { string s; cin >> s; const int n = s.size(); int ans = 0; for (int i = 0; i < n; i++) { int cnt = 1; for (int j = 1; i - j >= 0 && i + j < n; j++) { if (s[i - j] == s[i + j]) { cnt += 2; } } ans = max(ans, cnt); } for (int i = 0; i + 1 < n; i++) { int cnt = 0; for (int j = 0; i - j >= 0 && i + 1 + j < n; j++) { if (s[i - j] == s[i + 1 + j]) { cnt += 2; } } ans = max(ans, cnt); } cout << ans << endl; }