BWT by hirose

while 1:s=raw_input();l=len(s);k=sorted(s[i:]+s[:i]for i in range(l));print k.index(s),`k`[l+1::l+4]

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

download

return top