import System.IO main=mapM(`hSetEncoding`utf8)[stdin,stdout]>>interact(a.span(/='$')) a(t,r)=cycle t#lines r t#(l:r)|[_]<-l=t#r|(u,_:_:v)<-span(/='@')t=u++l++v#r _#_=""
Note that non-ascii characters in the above source code will be escaped (such as \x9f).