string@S,T=S;ll N=S.size(),P[99],L=Factor(N,P),o=2N,t,e;REP[P](p,L+1){ll d=N/p,a=0;rep(i,d){VI h(26);rep(j,p)++h[S[i+j*d]-65];t=0;rep[h,c](k,26)if(ta)o=a,P[L]=p;}wt(T);