#define _USE_MATH_DEFINES #include #include #include #include #include #include //#include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(16);// string S; cin>> S; int ma[50][50]; int Len = S.size(); rep(i,Len){ rep(j,Len){ if( S[i] == S[j] ){ ma[i][j] = 1; }else{ ma[i][j] = 0; } } } int ans = 0; int count; rep(i,Len)rep(j,Len){ int k = 0; count = 0; while( i+k =0 && ma[i+k][j-k] ){ ++count; ++k; } if( abs(i-j)+1 < Len ){ ans = max( ans , count ); } } P(ans); return 0; }