S = input() N = len(S) ans = 0 for i in range(N): for j in range(i + 1, N + 1): if i == 0 and j == N: continue if S[i:j] == S[i:j][::-1]: ans = max(ans, j - i) print(ans)