repeat l=io.read()T={}for i=1,#l do T[i]=(l..l):sub(i,#l+#T)end table.sort(T)S=" "x=0 for i=1,#l do x=T[i]<l and i or x S=S..T[i]:sub(-1)end until print(x..S)
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page