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