You are viewing a single comment's thread. Return to all comments →
Python3 regex one liner
def alternatingCharacters(s: str) -> int: return len(s) - len(re.sub(r"(\w)\1+", r"\1", s))
Seems like cookies are disabled on this browser, please enable them to open this website
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
Python3 regex one liner