Vowel Words with Allowed Successors

Asked at MathWorks · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026

Count the strings of a given length that can be built from the five vowels `a`, `e`, `i`, `o`, `u` when each vowel is allowed to be followed only by certain vowels. Return the count modulo `10^9 + 7`.

Loading the problem…