paren matching by Hendrik

import os
s=[];o=''
for c in os.read(0,999):s+=(c in"([{")*"]})"[cmp(c,'[')];o+=c*(c!='?')or s.pop()
print o

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

download

return to the top page