SnowflakeOA #8
String Patterns — Bounded Consecutive Vowels
Estimated MediumJudge-ready
Topics (AI-labelled)DP Basics
Count lowercase English strings of length n with at most k consecutive vowels. There are 5 vowels, aeiou, and 21 consonants. Output the count modulo 10⁹+7.
Input
One line: n k, with 1≤n≤2500 and 0≤k≤n.
Output
Output the single integer required by the problem.
Example 1
Input:
1 1
Output:
26
Example 2
Input:
4 1
Output:
412776
Example 3
Input:
4 2
Output:
451101
Example notes
The answers to the three public examples are, in order: 26; 412776; 451101. All examples have been verified by independent small-scale enumeration or state search.
Editorial
Loading solution…