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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Maintain a cnt
variable for the number of vowels in the -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 letters.
If the character is a vowel, increment the cnt
variable by .
If the cnt
variable is greater than or equal to , output good
; otherwise, output bad
.
Time Complexity:
Comments