Reverse BWT by rickrickrick

for l in io.lines()do n,s=l:match("(%d+).(%w+)")p={}for m=1,#s do for i=1,#s do p[i]=s:sub(i,i)..(p[i]or"")end table.sort(p)end print(p[n+1])end

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

download

return to the top page