LeetCode
Count Substrings with Only One Distinct Letter
Click
here
for an explanation.