import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np S = np.frombuffer(read().rstrip(),'S1') N = len(S) answer = 0 # 中心が n の場合 for n in range(N): left = S[:n][::-1] right = S[n+1:] L = min(len(left), len(right)) x = np.count_nonzero(left[:L] == right[:L]) * 2 + 1 if answer < x: answer = x # 中心が間の場合 for n in range(N): left = S[:n][::-1] right = S[n:] L = min(len(left), len(right)) x = np.count_nonzero(left[:L] == right[:L]) * 2 if answer < x: answer = x print(answer)