#include #include #include #include #include #include typedef long long ll; #define MOD 1000000007 using namespace std; int main(){ string S; int ans = 0; cin >> S; for(int center = 0; center < (int)S.length(); center++) { int left, right, cnt = 1; left = center - 1; right = center + 1; while (left >= 0 && right < (int)S.length()) { if (S[left--] == S[right++]) { cnt += 2; } } ans = max(ans, cnt); } for(int center = 0; center < (int)S.length() - 1; center++) { int left, right, cnt = 0; left = center; right = center + 1; while (left >= 0 && right < (int)S.length()) { if (S[left--] == S[right++]) { cnt += 2; } } ans = max(ans, cnt); } cout << ans << endl; return 0; }