class Solution:
    def isValid(self, s: str) -> bool:
        # 循环替换,直到字符串为空或者不变
        while True:
            ori = s
            s = s.replace("()", "").replace("{}", "").replace("[]", "")
            # 如果字符串为空,则为True
            if not s:
                return True
            # 如果字符串不再发生变化,则为False
            if s == ori:
                return False