You are viewing a single comment's thread. Return to all comments →
Python 3
def superReducedString(s): pattern = re.compile(r'(\w)\1') while matches := pattern.search(s): for letter, *_ in matches.groups(): s = s.replace(letter*2, "") if s == "": return "Empty String" return s
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
Python 3