import sys input = sys.stdin.readline S=list(input().strip()) # Manacher # https://snuke.hatenablog.com/entry/2014/12/02/235837 T=[] for s in S: T.append(s) T.append("0") LEN=len(T) i=0 j=0 R=[0]*LEN # 文字 i を中心とする最長の回文の半径 while i=0 and i+j=0 and i+k=mid-l+1: return True else: return False DP=[0]*(len(S)+1) DP[0]=1<<60 for i in range(len(S)): for j in range(i,len(S)): if pali(i,j)==True: DP[j+1]=max(DP[j+1],min(DP[i],j+1-i)) print(DP[-1])