#coding: utf-8 ##yuki_273 def palindrome(string): return 1 if string==string[::-1] else 0 s=raw_input() n=len(s) res=0 for i in xrange(n): for j in xrange(n): if palindrome(s[i:n-j])==1: res_temp=len(s[i:n-j]) if res_temp>res: res=res_temp print res