BWT by Defenestrator

while 1:s=raw_input();n=len(s);m=sorted(s[i:]+s[:i]for i in range(n));print m.index(s),''.join(m)[n-1::n]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page