Counting Substrings with Only One Distinct Letter with Different Algorithms
Given a string S, return the number of substrings that have only one distinct letter. Example 1: Input: S = “aaaba” Output: 8 Explanation: The substrings with one distinct …