TopcoderArchiveVisit Topcoder
SRM30 Apr 2005
SRM 240

Pronunciation

Problem statement, definition, constraints, and public examples.

Problem Statement

Peter has problems with pronouncing difficult words. In particular he can't pronounce words that contain three or more consecutive consonants (such as "street" or "first"). Furthermore he can't pronounce words that contain two or more consecutive vowels that are different (such as "goal" or "beauty"). He can pronounce words with two consecutive equal vowels though (such as "need").

Is this problem we consider the 'y' to be always a consonant, even in words like "any". So the vowels are 'a', 'e', 'i', 'o' and 'u'. You are given a String[] words. If Peter can pronounce all the words, return an empty String; otherwise return the first word he can't pronounce.

Definition

Class:
Pronunciation
Method:
canPronounce
Parameters:
String[]
Returns:
String
Method signature:
String canPronounce(String[] words)
(be sure your method is public)

Constraints

  • words contains between 1 and 50 elements, inclusive.
  • Each element of words has length between 1 and 50, inclusive.
  • Each element of words consists of upper- and lowercase letters.

Examples

  1. {"All","of","these","are","not","difficult"}
    Returns: ""
  2. {"The","word","REALLY","is","really","hard"}
    Returns: "REALLY"
  3. {"TRiCKy"}
    Returns: "TRiCKy"
    Since the 'y' is a consonant, this word contain three consecutive consonants.
  4. {"irresistable","prerogative","uttermost","importance"}
    Returns: ""
    Peter can pronounce these words.
  5. {"Aa"}
    Returns: ""
Back to all problems