def longest_palindrome(s): n = len(s) i = 0 j = 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 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)) # max_rad = 0 # max_i = 0 # for i in range(2 * n): # if rad[i] > max_rad: # max_rad = rad[i] # max_i = i # return S[(max_i + 1 - max_rad) // 2: (max_i + 1 + max_rad) // 2] S = input() N = len(S) if S == S[::-1]: longest_palindrome(S[1:]) else: longest_palindrome(S) # l = len(longest_palindrome(S)) # if l == N: # print(len(longest_palindrome(S[1:]))) # else: # print(l)