def longest_palindrome(s): n = len(s) i = 0 j = 0 max_rad = 0 rad = [0 for i in range(2 * n)] while i < 2 * n: while i - j >= 0 and i + j + 1 < 2 * n and s[(i - j) // 2] == s[(i + j + 1) // 2]: j += 1 rad[i] = j max_rad = max(max_rad, j) k = 1 while i - k >= 0 and rad[i] - k >= 0 and rad[i - k] < rad[i] - k: rad[i + k] = min(rad[i - k], rad[i] - k) k += 1 i += k j = max(j - k, 0) print(max_rad) S = input() if S == S[::-1]: longest_palindrome(S[1:]) else: longest_palindrome(S)