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