paren matching by alex

import std.c.stdio;void main(){int x;int[]a;int[int]b=[40:1,91:1,123:1];while((x=getchar())>0){if(x in b)a~=[x+(x<41?1:2)];if(x==63)x=a[$-1],a=a[0..$-1];putchar(x);}}

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

download

return to the top page