You are viewing a single comment's thread. Return to all comments →
def alternatingCharacters(s): return sum([s[i] == s[i + 1] for i in range(len(s) - 1)])
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
def alternatingCharacters(s): return sum([s[i] == s[i + 1] for i in range(len(s) - 1)])