# 考虑密码长度是奇数还是偶数。
# 添加固定符号到原字符串,使其总长度变为奇数,且不改变回文的特性。
# 按照奇数的处理方法,最后返回时去掉固定符号 。
# 移动中心指针,每次都调整左右指针截取字符串,不停地找最长的回文字符串
from time import strptime
while True:
try:
chars = input()
strPlus = '#'
for i in chars:
strPlus += i
strPlus += '#'
result = ''
for point in range(1,len(strPlus)-1):
left = point -1
right = point +1
while left >= 0 and right < len(strPlus) and strPlus[left] == strPlus[right]:
result = strPlus[left:right+1] if len(strPlus[left:right+1]) > len(result) else result
# print(result)
left -= 1
right += 1
res = result.replace("#","")
print(len(res))
except:
break