class Solution:
def isValid(self, s: str) -> bool:
while '[]' in s or '{}' in s or '()' in s:
s=s.replace('[]','').replace('()','').replace('{}','')
return True if s=='' else False
S=Solution()
assert S.isValid('()')==True
assert S.isValid('()[]{}')==True
assert S.isValid('(]')==False
assert S.isValid('([)]')==False
assert S.isValid('{[]}')==True