You are viewing a single comment's thread. Return to all comments →
def alternatingCharacters(s): s2 = re.sub(r'([AB])\1+', r'\1', s) return len(s) - len(s2)
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 →