S = input() cnt = 0 N = len(S) for i in range(N): for j in range(i+1, N+1): T = S[i:j] if T == T[::-1]: if cnt < len(T) < N: cnt = len(T) print(cnt)