#include #include #include #include #include #include #include #include #include #include #include #include #include #define p(s) cout<<(s)<=n;i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define F first #define S second typedef long long ll; using namespace std; const ll mod = 1e9+7; string s; int ans; int main() { cin>>s; int n = s.size(); ans = 1; REP(l,0,n){ REP(r,l+1,n){ int a=0; REP(i,0,(r-l+1)/2){ if(s[l + i]!=s[r - i]){ a+=2; } } ans = max(ans, (r-l+1) - a); } } p(ans); return 0; }