s = input()
r = 1
for i in range(len(s)-1):
for j in range(i+1, len(s)+1):
p = s[i:j]
l = len(p)
if p == p[::-1] and l > r:
r = l
print(r)
s = input()
r = 1
for i in range(len(s)-1):
for j in range(i+1, len(s)+1):
p = s[i:j]
l = len(p)
if p == p[::-1] and l > r:
r = l
print(r)