Alice is trying to type a specific string, but she's a bit clumsy with her keyboard! ๐ฎ
When Alice types, she sometimes holds keys for too long, causing characters to be repeated multiple times. Given the final string that appears on her screen and a minimum length k, you need to find how many different original strings Alice might have intended to type.
The Challenge: Alice's original string must be at least k characters long. Each group of consecutive identical characters in the typed string could represent 1 or more of that character in the original string.
Example: If Alice typed "aabbcc" and k=3, the original could be "abc", "aabc", "abbc", "abcc", etc.
Return the total count modulo 109 + 7 since the answer can be very large!
Input & Output
Constraints
- 1 โค word.length โค 1000
- 1 โค k โค word.length
- word consists only of lowercase English letters
- Answer should be returned modulo 109 + 7