Problem 82. Remove the small words from a list of words.
Your job is to tidy up a list of words that appear in a string. The words are separated by one or more spaces. Remove all words that are one or two letters long and make sure that exactly one space separates all the words. Strings will be made up only of letters and spaces. Spaces should not appear at the beginning or end of your output string.
Example:
inStr = 'ours is not to reason why'; outStr = 'ours not reason why';
Solution Stats
Problem Comments
-
1 Comment
Khaled Hamed
on 3 Aug 2012
This problem is tricky! Better add more test cases and rescore. E.g., 'aaa bb'
Solution Comments
Show commentsProblem Recent Solvers1495
Suggested Problems
-
Remove any row in which a NaN appears
8587 Solvers
-
3834 Solvers
-
It dseon't mettar waht oedrr the lrettes in a wrod are.
1809 Solvers
-
Find the sum of the elements in the "second" diagonal
1149 Solvers
-
668 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!