BWT by eban

#!ruby -p
c=b=scan(/./)
a=b.map{[]+(b<<b.shift)}.sort
$_="#{a.index c} #{a.map{|x|x.pop}}
"

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

download

return top