import sys
for line in sys.stdin.readlines():
line = line.strip()
length = len(line)
ret = 1
for i in range(1, length - 1):
left = i - 1
right = i + 1
while line[i] == line[left] and left >= 0:
left -= 1
while line[i] == line[right] and right < length:
right -= 1
while (left >= 0 and right < length and line[left] == line[right]):
left -= 1
right += 1
ret = max(right - left - 1, ret)
print(ret)


京公网安备 11010502036488号