import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read().rstrip() N = len(S) answer = 0 for i in range(N): for j in range(i+1,N+1): T = S[i:j] if T != T[::-1]: continue if len(T) == N: continue if answer < len(T): answer = len(T) print(answer)