|
|
@ -16,8 +16,9 @@ for l in lines: |
|
|
|
if c == '(' or c == '[' or c == '{' or c == '<': |
|
|
|
if c == '(' or c == '[' or c == '{' or c == '<': |
|
|
|
stack.append(c) |
|
|
|
stack.append(c) |
|
|
|
if c == ')' or c == ']' or c == '}' or c == '>': |
|
|
|
if c == ')' or c == ']' or c == '}' or c == '>': |
|
|
|
if stack.pop() != [x[0] for x in di if x[1] == c][0][0]: |
|
|
|
match = [x for x in di if x[1] == c][0] |
|
|
|
score1 += [x for x in di if x[1] == c][0][2] |
|
|
|
if stack.pop() != match[0]: |
|
|
|
|
|
|
|
score1 += match[2] |
|
|
|
valid = False |
|
|
|
valid = False |
|
|
|
break |
|
|
|
break |
|
|
|
if valid: |
|
|
|
if valid: |
|
|
|