S = raw_input() ans = 0 for i in range(len(S) - 1): left,right = 1,1 cnt = 1 while i - left >= 0 and i + right < len(S) and S[i - left] == S[i + right]: cnt += 2 left += 1 right += 1 ans = max(ans,cnt) for i in range(len(S) - 1): left,right = i,i + 1 cnt = 0 while left >= 0 and right < len(S) and S[left] == S[right]: cnt += 2 left -= 1 right += 1 ans = max(ans,cnt) print ans