Super Reduced String

  • + 0 comments

    My answer in Python

    def superReducedString(s):
        print(s)
        pattern = r"(.)\1"
        
        while re.search(pattern, s):
            s = re.sub(pattern, "", s)
            print(s)
        
        if s:
            return s
        else:
            return "Empty String"