def f(c, i, j):
while i < j:
if c[i] != c[j]:
return False
i += 1
j -= 1
return True
c = str(input())
i = 0
j = len(c) - 1
if f(c, i, j):
print(len(c) // 2 + 1)
exit()
while i < j:
if c[i] != c[j]:
if f (c, i, j - 1):
print(j + 1)
exit()
if f (c, i + 1, j):
print (i + 1)
exit()
print('0')
exit()
i = i + 1
j = j - 1