Problem 920. Eliminate Polysyllabics: Long live short words!
Given a string s1, return s2 in which all the words with more than one syllable have been removed.
To make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.
So these words are polysyllabic:
ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS
These words are monosyllabic:
STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE
Here are some examples of one-syllable words that I WON'T use because they violate my rules:
ONE ICED JUICE PLEASE
After you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.
Example:
Input: 'The all day meetings will continue until we learn why productivity is so low'
Output: 'The all day will we learn why is so low'
Solution Stats
Problem Comments
-
2 Comments
asserts are commented out in the test suite...
Whoops! Thanks for pointing that out. I might've eventually gotten suspicious after seeing absolutely everybody passing...
Solution Comments
Show commentsGroup

Card Games
- 18 Problems
- 25 Finishers
- Card Game
- SET (the card game)
- Poker Series 01: isStraightFlush
- Mongean Shuffle : 2
- Mongean Shuffle
- Combine Cards to make 21
- Poker Card Deal!
- Clock Solitaire
- SET (the card game)
- Poker Series 11: selectBestHand
- Poker Series 10: bestHand
- Poker Series 09: IsHighCard
- Poker Series 08: IsPair
- Poker Series 07: IsTwoPair
- Poker Series 06: isThreeKind
- Poker Series 05: isStraight
- Poker Series 04: isFlush
- Poker Series 03: isFullHouse
- Poker Series 02: isQuads
- Poker Series 01: isStraightFlush
Problem Recent Solvers129
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!