#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define FORR(x, arr) for(auto& x:arr) #define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; typedef pair P; string s; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> s; int ma = 1; FOR(i, s.size()) { int cnt = 1; for (int j = 1; i+j=0; j++) { if (s[i+j]==s[i-j]) cnt += 2; } ma = max(ma, cnt); } FOR(i, s.size()) { for (int j = 1; i+j=0; k++) { if (s[i+j+k]==s[i-k]) cnt += 2; } ma = max(ma, cnt); } } } cout << ma << endl; return 0; }