def isValid(s) :
stack = []
for i in s:
t= True
if i=="(" or i=="{" or i=="[":
stack.append(i)
elif i==')' and stack[-1]=="(":
stack.pop()
elif i=='}' and stack[-1]=="{":
stack.pop()
elif i==']' and stack[-1]=="[":
stack.pop()
else:
t= False
return t
print(isValid("()"))