from collections import deque def Manacher(S): N=len(S) manacher=[None]*N i,j=0,0 while i=cur: ans=min(ans,cnt+1) break if cur<=palindrome[cur//2]*2: break cur=palindrome[cur//2]*2 cnt+=1 S=S[::-1] if ans==inf: ans=-1 else: ans=-1 print(ans)