You are viewing a single comment's thread. Return to all comments →
Python 3
return sum(s[i] == s[i-1] for i in range(1, len(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 →
Python 3