def is_palindrome(s): n = len(s) if s == s[::-1]: return True else: return False S = input() N = len(S) max_lenght = 0 for lenght in range(N - 1, 0, -1): for i in range(N - lenght): if is_palindrome(S[i:i + lenght]): print(lenght) exit()