from collections import Counter
import sys
input = sys.stdin.readline


S=input().strip()
LEN=len(S)
C=Counter(S)
ANS=LEN
ind=-1

for a in C:
    x=C[a]

    if ANS>LEN-x:
        ANS=LEN-x
        ind=[a]

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=Counter()
            for j in range(t):
                C[S[j*dis+i]]+=1
            MAX=0
            indm=""

            for c in C:
                if MAX<C[c]:
                    MAX=C[c]
                    indm=c
            score+=t-MAX
            L.append(indm)

        if score<ANS:
            ANS=score
            ind=L
                
LANS=ind*(LEN//len(ind))

print("".join(LANS))