S = input() N = len(S) ans = 1 for center in range(N): tmp = 1 for idx in range(1, N): if not (0 <= center - idx and center + idx < N): break if S[center - idx] == S[center + idx]: tmp += 2 ans = max(ans, tmp) tmp = 0 for idx in range(N): if not (0 <= center - 1 - idx and center + idx < N): break if S[center - 1 - idx] == S[center + idx]: tmp += 2 ans = max(ans, tmp) print(ans)