S = input() N = len(S) ans = 0 for i in range(N): ret = 1 d = 1 while i - d >= 0 and i + d < N: if S[i - d] == S[i + d]: ret += 2 d += 1 ans = max(ans,ret) ret = 0 d = 1 while i - d >= 0 and i + d - 1 < N: if S[i - d] == S[i + d - 1]: ret += 2 d += 1 ans = max(ans,ret) print(ans)