Tap here to switch tabs
Problem
Submissions

Problem: Count Substrings with Only One Distinct Letter

Count Substrings with Only One Distinct Letter asks you to count every contiguous substring of a given string whose characters are all the same.

Statement

Given a string s, return the total number of substrings that contain only one distinct letter.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] consists of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Substrings with Only One Distinct Letter

Count Substrings with Only One Distinct Letter asks you to count every contiguous substring of a given string whose characters are all the same.

Statement

Given a string s, return the total number of substrings that contain only one distinct letter.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] consists of only lowercase English letters.