g x=length$takeWhile(==' ')x\x0d r=reverse\x0d a x=g$r x\x0d d=dropWhile\x0d e=drop\x0d v m x=minimum(map m(lines x))\x0d n=v g\x0d b=v a\x0d f x=(d(==' ')x)==[]\x0d z x=unlines(map (r.(e$b x).r.(e$n x))(d f(lines x)))\x0d main=interact z
Note that non-ascii characters in the above source code will be escaped (such as \x9f).