# 感觉有点像最长回文子串
s = input()
n = len(s)

def expand(s, i, j):
    while i >= 0 and j < n and s[i] == s[j]:
        i -= 1
        j += 1
    return j - i - 1

ans = 0
for i in range(n):
    ans = max(ans, expand(s, i, i))
    ans = max(ans, expand(s, i, i+1))
print(ans)