def isValid(self, s: str) -> bool:
if len(s)&1!=0:
return False
q=deque()
for i in s:
if i=='(' or i=='{' or i=='[':
q.append(i)
elif len(q)!=0 and ((q[-1]=='(' and i==')') or (q[-1]=='[' and i==']') or (q[-1]=='{' and i=='}')):
q.pop()
else:
return False
if len(q)==0:
return True
return False