TopcoderArchiveVisit Topcoder
SRM12 Jul 2001
SRM 13

GoodWord

Problem statement, definition, constraints, and public examples.

Problem Statement

Class Name:  GoodWord
Method Name: isValid
Parameters:  String
Returns:     boolean

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.

Examples:
"Hi" returns false.
"Hih" returns true.
"Baaaiedddffaigg" returns true.
"H" returns true.

Definition

Class:
GoodWord
Method:
isValid
Parameters:
String
Returns:
boolean
Method signature:
boolean isValid(String param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems