Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Homogenous Substrings

med
30 min
Try to solve the Count Number of Homogenous Substrings problem.

Statement

Given a string s, return the total number of homogenous substrings present in s.

A string is considered homogenous if every character in the string is identical.

A substring is a contiguous non empty sequence of characters within a string.

Note: Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Homogenous Substrings

med
30 min
Try to solve the Count Number of Homogenous Substrings problem.

Statement

Given a string s, return the total number of homogenous substrings present in s.

A string is considered homogenous if every character in the string is identical.

A substring is a contiguous non empty sequence of characters within a string.

Note: Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase letters.