Back and forth by masterq

l=length\x0d
j _ _[]=""\x0d
j r t(x:s)=([1..t-d]>>" ")++x++"\n"++j(mod(r+1)2) u s where(d,u)=last$(l x,t-l x):[(0,t+l x)|r==0]\x0d
main=interact(j 0 0.zipWith($)(cycle[id,reverse]).words)

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

download

return to the top page