TopcoderARCHIVE
Archive/Problems/EllysPronunciation
SRM · Problem 13933

EllysPronunciation

Problem statement, definition, constraints, and public examples.

Problem Statement

Elly is constantly learning new languages. Sometimes she has difficulties with the pronunciation, mainly caused by excessive presence of vowels over consonants or vice-versa in the words. She considers a word easy to pronounce if it has equal number of vowels and consonants. As you can see yourself, words like "allure", "voulez", "vorliebe", and "amor" are relatively easy to say out loud, unlike, for example, "wrath", "ecoeurement", "abneigung", or "odiar".

You are given the words that Elly has learned this week in the String[] words. Count how many of them are "easy" to pronounce (i.e. have equal number of vowels and consonants).

Definition

Class:
EllysPronunciation
Method:
getGood
Parameters:
String[]
Returns:
int
Method signature:
int getGood(String[] words)
(be sure your method is public)

Notes

  • For this problem we will consider the letters 'a', 'e', 'i', 'o', and 'u' to be vowels, and all other - consonants.

Constraints

  • words will contain between 1 and 50 elements, inclusive.
  • Each element of words will contain between 1 and 50 characters, inclusive.
  • All elements of words will contain only lower-case letters of the English alphabet ('a'-'z').

Examples

  1. {"wrath", "allure", "vorliebe", "abneigung", "amor", "voulez", "ecoeurement", "odiar"}
    Returns: 4
    The example from the problem statement.
  2. {"schornsteinfeger", "schmetterling", "lohnsteuerabzugsbescheinigung", "shifffahrt",
     "deutsch", "ist", "die", "schoenste", "sprache", "auf", "der", "welt"}
    Returns: 0
    The German is a horrible language.
  3. {"hearing", "vision", "smell", "touch", "taste",
     "denial", "anger", "bargaining", "depression", "acceptance",
     "war", "famine", "plague", "death",
     "pog", "story", "sarah", "gender", "baleen",
     "posh", "sporty", "scary", "ginger", "baby", "spice"}
    Returns: 5
    Here the good words are {"vision", "denial", "famine", "plague", "baleen"}.
  4. {"this", "was", "a", "triumph",
     "i", "am", "making", "a", "note", "here", "huge", "success",
     "its", "hard", "to", "overstate", "my", "satisfaction"}
    Returns: 5
    It is possible that some of the given words are repeated, or consist of a single character. Please also note that in this problem we consider 'y' to be a consonant.
  5. {"wir", "werden", "alle", "sterben", "haltet", "euch", "bereit",
     "die", "zeichen", "sind", "eindeutig", "bald", "ist", "es", "soweit",
     "vielleicht", "schon", "heute", "abend", "vielleicht", "in", "einem", "jahr",
     "doch", "alle", "verden", "sterben", "traurig", "aber", "wahr"}
    Returns: 8
    Here the eight good words are: "alle", "euch", "bereit", "es", "soweit", "in", "alle", and "aber". Please note that each good word should be counted as many times as it is present in the list (in this example "alle" should be counted twice).
← All problems