Ejection by bk1e

d=[];r=[];u=[]
$<.map{|l|l.chomp!
z=l.size
z.times{|i|[[d,?D],[u,?U]].map{|a,b|l[i]==b&&(e=a.find{|c|l[i]!=c[i]}
e||(a<<" "*z;e=a[-1])
e[i]=l[i])}}
r<<l.tr("DRU","   ")+l.tr("^R","")}
puts (u.reverse+r+d).map{|l|l.rstrip}

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

download

return top