Bracket Matching by mskzzzz

def b(m):
 if m:print m
 s=raw_input();l=[9];f='failed at: '
 while s:c='({[<)}]>'.find(s[0]);l+=[c]*(c<4or l.pop()-c+4and b(f+s));s=s[1:]
 b(('yes',f+'EOL')[l>[9]])
b(0)

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

download

return to the top page