S = input() N = len(S) ans = 0 for i in range(N): center1 = i cnt = -1 for j in range(center1+1): if 2*center1-j >= N: continue if S[j] == S[2*center1-j]: cnt += 2 ans = max(ans,cnt) center2 = i cnt = 0 for j in range(center1+1): if 2*center1-j+1 >= N: continue if S[j] == S[2*center1-j+1]: cnt += 2 ans = max(ans,cnt) print(ans)