# # # @param s string字符串 # @return bool布尔型 # class Solution: def isValid(self , s ): # write code here dic = {'(':')','{' :"}",'[':']'} first = [] for ss in s: if ss in dic.keys(): first.append(ss) if ss in dic.values(): if len(first) == 0: return False tem = first.pop() if ss == dic[tem]: continue else: return False return True if len(first)==0 else False