BWT by shinh

#!ruby -n
o=chomp
a=scan(/./).map{$_=$_[1,99]+$_[0,1]}.sort
puts"#{a.index o} "+a.map{|x|x[-1,1]}*''

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

download

return top