Bracket Matching by pp

def p(r):
 if r:print r
 l=raw_input();s=[];m="failed at: "
 while l:i="<{[(>}])".find(l[0]);s+=[i]*(i<4or i-s.pop()!=4and p(m+l));l=l[1:]
 p(["yes",m+"EOL"][len(s)>0])
p(0)

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

download

return to the top page