s = input() maxlen = 0 for i in range(len(s)-1): for j in range(i+1,len(s)+1): if s[i:j] == s[i:j][::-1] and len(s[i:j]) != len(s): maxlen = max(maxlen,len(s[i:j+1])) print(maxlen)