题解 | #括号序列#
括号序列
http://www.nowcoder.com/practice/37548e94a270412c8b9fb85643c8ccc2
s=input()
als=[s[0]]
hefa={'(':')','[':']','{':'}','"':'"',"'":"'"}
for i in s[1:]:
if (als[-1],i) in hefa.items():
als.pop()
else:
als.append(i)
print('true') if len(als)==0 else print('false')
查看12道真题和解析