You are viewing a single comment's thread. Return to all comments →
def alternatingCharacters(s): return sum(len(tuple(v)) - 1 for _, v in itertools.groupby(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 →