-module(test).\x0d -export([m/0]).\x0d m()->X=g(),p(X),p([10|m(X)]).\x0d m(L)->case g()of eof->L;M->p(M),m(s(L,M))end.\x0d s([A,B,C|T],[_,$-|Z])->[C,B|s([A|T],Z)];s([A,B|T],[_,_|Z])->[A,B|s(T,Z)];s(L,_)->L.\x0d g()->io:get_line("").\x0d p(X)->io:put_chars(X).\x0d
Note that non-ascii characters in the above source code will be escaped (such as \x9f).