import sys input = sys.stdin.readline S=input().strip() LEN=len(S) C=[0]*26 ANS=LEN ind=-1 for s in S: C[ord(s)-65]+=1 for i in range(26): x=C[i] if ANS>LEN-x: ANS=LEN-x ind=[chr(i+65)] x=LEN for t in range(2,LEN): if x%t==0: while x%t==0: x//=t dis=LEN//t score=0 L=[] for i in range(dis): C=[0]*26 for j in range(t): C[ord(S[j*dis+i])-65]+=1 MAX=0 indm="" for j in range(26): if MAX