Riolku's Mock CCC S1 - Word Bot

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type

Mosey Maker is practicing how to use words!

To help him with his words, he made up a bot to recognize them. However, his bot isn't that intelligent.

His bot recognizes words as a list of alphabetic characters. Mosey Maker's bot doesn't think long sequences of vowels or consonants is valid, so if more than C consonants or V vowels are seen in a row, his bot does not consider it a word. Note that the vowels are aeiouy, and the consonants are bcdfghjklmnpqrstvwxyz. Note that y counts as both a consonant and a vowel.

Unfortunately, Mosey Maker lost his bot, and wants you to recode it.

Given a single word of N characters, is it valid?


1 \le N, C, V \le 10^5

The word will only contain lowercase alphabetic characters.

Subtask 1 [5/15]

The letter y will not appear in the word.

Subtask 2 [10/15]

No additional constraints.

Input Specification

The first line will contain three integers, N, C and V.

The next line will be the word Mosey wants you to check.

Output Specification

Output YES if the word is valid and NO otherwise.

Sample Input 1

12 3 3

Sample Output 1


Explanation for Sample Output 1

Note that although it is a valid english word, onomatopoeia has too many trailing vowels to be a valid word.

Sample Input 2

8 2 4

Sample Output 2


Sample Input 3

10 8 2

Sample Output 3


Explanation for Sample Output 3

Note that since y is both a vowel and a consonant, aay is considered a string of 3 vowels.

Sample Input 4

5 4 4

Sample Output 4



There are no comments at the moment.