def fun(str_input):
max_len = 0
for i in range(len(str_input)):
for j in range(len(str_input) - 1, i - 1, -1):
if str_input[i: j + 1][::-1] == str_input[i: j + 1]:
if j + 1 - i > max_len:
max_len = j + 1 - i
return max_len
while True:
try:
str_input = input()
print(fun(str_input))
except:
break