They say that hate
is a strong word. I wanted to find out why, so I had a good look at the word.
I noticed that every consonant had a vowel after it. That made it look quite strong to me, so I decided that that's what makes a word strong.
I want to find more strong words, so I'll need a program for it!
Finding strong words
Strong words are words where every consonant (letters in the set BCDFGHJKLMNPQRSTVWXZ
) is followed by a vowel (letters in the set AEIOUY
). That's it. Nothing else matters.
If the word starts with a vowel, you don't have to worry about any of the letters before the first consonant. If the word has no consonants in it at all, it's automatically a strong word!
Some examples of strong words are agate
, hate
and you
. agate
is still a strong word because although it starts with a vowel, every consonant is still followed by a vowel. you
is a strong word because it has no consonants.
There is no restriction on length for strong words.
The challenge
Write a program or function that takes a non-empty string as input, and outputs a truthy value if it is a strong word or a falsy value if it is not.
Clarifications
- You may decide to take the input in either lowercase or uppercase. Specify which in your answer.
- Words will not contain punctuation of any kind. They will only contain plain letters in the set
ABCDEFGHIJKLMNOPQRSTUVWXYZ
. - Instead of truthy and falsy values, you may choose two distinct and consistent values to return for true and false. If you do this, specify the values you have picked in your answer.
- You may alternatively output a falsy value for a strong word and a truthy one for a non-strong word.
Test cases
Input -> Output
hate -> true
love -> true
popularize -> true
academy -> true
you -> true
mouse -> true
acorn -> false
nut -> false
ah -> false
strong -> false
false -> false
parakeet -> false
Scoring
Since this is code-golf, the answer with the least bytes wins!
""
a possible input? \$\endgroup\$