text of lowercase English letters. Count its substrings made of a single repeated letter, such as "q" or "ppp".
A substring is a contiguous piece of the string; equal substrings at different positions are counted separately.text="xxyxx" → 7
Each of the five letters is a one-letter substring, plus two pieces "xx". That makes 7.
text="mmmm" → 10
4 substrings of length 1, 3 of length 2, 2 of length 3 and 1 of length 4: 4 + 3 + 2 + 1 = 10.
text="abc" → 3
No two neighbors match, so only the three single letters count.
text consists of lowercase English letterstext="xxyxx"
7
Run checks the first 3 tests in your browser. Submit checks all 60 tests on the server, hidden ones included.