a, e, i, o and u, and each vowel has its own rule about what may come right after it:
- after a, only e;
- after e, either a or i;
- after i, any vowel except i;
- after o, either i or u;
- after u, only a.
Count the strings of length length that follow all the rules. The answer can be large, so return it modulo 10⁹ + 7.length=1 → 5
Each of the five vowels on its own is a valid string.
length=2 → 10
"ae", "ea", "ei", "ia", "ie", "io", "iu", "oi", "ou" and "ua": 10 strings.
length=3 → 19
length=1
5
Run checks the first 3 tests in your browser. Submit checks all 28 tests on the server, hidden ones included.