Class Name: GoodWord
Method Name: isValid
In a certain language, words are valid if and only if each group of vowels in
the word is followed by exactly the same number of consonants (no more, no
less) and the first letter is capital and all other letters are lowercase.
Implement a class GoodWord, which contains a method isValid. isValid takes a
String as a parameter and returns a boolean that is true if the String is a
valid word in the language and false otherwise.
Vowels are a, e, i, o, and u (and their capital equivalents). All other
letters are consonants.
Here is the method signature:
boolean isValid(String word);
TopCoder will ensure the following:
- word contains between 1 and 50 letters.
"Hi" returns false.
"Hih" returns true.
"Baaaiedddffaigg" returns true.
"H" returns true.