BWT by hiro.suzuki 

while 1:L=raw_input();S=sorted([L[i:]+L[:i]for i in range(len(L))]);print S.index(L),`S`[i+2::i+5]

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

download

return top