Given a string s, return the number of homogenous substrings of s. Since the answer may be too large, return it modulo 109 + 7.
A string is homogenous if all the characters of the string are the same.
A substring is a contiguous sequence of characters within a string.
Input: s = "xy"
Output: 2
Explanation: The homogenous substrings are "x" and "y".
Example 3
Input: s = "zzzzz"
Output: 15
Constraints
1 <= s.length <= 105
s consists of lowercase letters.
1759. Count Number of Homogenous Substrings
Medium
30 Points
Math
String
Given a string s, return the number of homogenous substrings of s. Since the answer may be too large, return it modulo 109 + 7.
A string is homogenous if all the characters of the string are the same.
A substring is a contiguous sequence of characters within a string.