1180. Count Substrings with Only One Distinct Letter

Problem

Count the number of substrings of s that consist of only one distinct letter.

Given a string s, count the total number of substrings that contain only one distinct letter. A substring is a contiguous sequence of characters.

Examples
Input: "aaaba"
Output: 8
Hints
Related Problems

1180. Count Substrings with Only One Distinct Letter

Count the number of substrings of s that consist of only one distinct letter.