#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVL; typedef vector VVI; typedef pair P; typedef pair PL; int main() { string s; cin >> s; int n = s.length(); int ans = 0; REP(i,n){ int tmp = 1; FOR(j,1,min(i,n-i-1)) if (s[i-j] == s[i+j]) tmp += 2; ans = max(ans, tmp); } REP(i,n-1){ int tmp = 0; FOR(j,0,min(i,n-i-2)) if (s[i-j] == s[i+j+1]) tmp += 2; ans = max(ans, tmp); } cout << ans << endl; return 0; }