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