while gets\x0d v=$_.chomp\x0d while 1\x0d (puts"yes";break)if v==""\x0d v=~/^[\(\[\{<]+/\x0d if $&\x0d a,b=$&,$'\x0d a[-1,1]+b[0,1]=~/\(\)|\{\}|\[\]|<>/\x0d if $&\x0d v=a[0..-2]+b[1..-1]\x0d else\x0d v=v.sub!(/^[\(\[\{<]+/,'')==""?"EOL":v\x0d puts"failed at: "+v\x0d break\x0d end\x0d end\x0d end\x0d end
Note that non-ascii characters in the above source code will be escaped (such as \x9f).