def kx(s): for w in range(len(s)-1,0,-1): for x in range(len(s)-w+1): r=s[x:x+w] if r==r[::-1]: return len(r) return 0 N=kx(input()) print(N)