Ejection by kotauchi

f=lambda s,t:["".join(i)for i in zip(*[(i.ljust(max(len(j)for j in t)))[::s]for i in t])]\x0d
g=lambda k:[k*i.count(k)for i in("".join(i)for i in zip(*a))]\x0d
for i in f(-1,g("U"))+["".join(" "if"#"!=j else j for j in i)+"R"*i.count("R")for i in a]+f(1,g("D")):print i.rstrip()

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


return top