def is_palindrome(s): return s == s[::-1] def f(s): if len(s) == 1: return 1 result = 0 for i in range(1, len(s)): a, b = s[:i], s[i:] if not is_palindrome(a): continue result = max(result, len(a)) if is_palindrome(b): result = max(result, len(b)) else: result = max(result, f(b)) return result S = input() print(f(S))