Bracket Matching by 51b

-module(b).
-export([m/0]).
m()->S=io:get_line(''),S<z orelse io:fwrite(f([9],S))>m().
f([],[])->"yes
";f([G|S]=L,[H|T]=R)->if H rem 7band 2>1->if abs(G-H)>2->"failed at: "++if H>10->R;0<1->"EOL
"end;0<1->f(S,T)end;0<1->f([H|L],T)end.

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

download

return to the top page