Pronunciation
SRM 240 · 2005-04-30 · by Jan_Kuipers
SRM 240 · 2005-04-30 · by Jan_Kuipers · Brute Force, Simple Search, Iteration, String Manipulation
Problem Statement
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 aString[] words. If Peter can pronounce all the words, return an empty String ; otherwise return the first word he can't pronounce.
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
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
0)
{"All","of","these","are","not","difficult"}
Returns: ""
1)
{"The","word","REALLY","is","really","hard"}
Returns: "REALLY"
2)
{"TRiCKy"}
Returns: "TRiCKy"
Since the 'y' is a consonant, this word contain three consecutive consonants.
3)
{"irresistable","prerogative","uttermost","importance"}
Returns: ""
Peter can pronounce these words.
4)
{"AA","Aa","aA","aa","EE","ee","Ee","eE","Ii","iI","II","ii","OO","oo","Oo","oO","UU","Uu","uU","uu"}
Returns: ""
Submissions are judged against all 57 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class Pronunciation with a public method string canPronounce(vector<string> words) · 57 test cases · 2 s / 256 MB per case