S = input() N = len(S) ans = 0 def isPalindrome(p): s,t,c = 0,len(p) - 1,0 while s < t and p[s] == p[t]: s,t,c= s + 1,t - 1,c + 2 if s == t and p[s] == p[t]: c += 1 return c == len(p) for i in range(N): for j in range(i,N): if len(S[i:j + 1]) < N and isPalindrome(S[i:j + 1]): ans = max(ans,len(S[i:j + 1])) print (ans)