'('
,')'
,'{'
,'}'
,'['
,']'
的字符串 s
,判断字符串是否有效。()[]{}
s=input() dic = {'{': '}', '[': ']', '(': ')'} st = [""]*20 top=-1 flag=True for c in s: if c in dic: top+=1 __________ elif top>=0: if dic[st[top]]==c: __________ else: flag=False break else: flag=False break if __________: print(True) else: print(False)