Editorial for SAC '22 Code Challenge 4 Junior P1 - Obligatory DeMello Problem


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: maxcruickshanks

Maintain a cnt variable for the number of vowels in the 5-letter word.

Loop through every character and check if it is in the set of vowels aeiouy.

Alternatively, hard code a vowel check for each of the 5 letters.

If the character is a vowel, increment the cnt variable by 1.

If the cnt variable is greater than or equal to 2, output good; otherwise, output bad.

Time Complexity: \mathcal{O}(5)


Comments

There are no comments at the moment.