Problem 1376. Find names/words that start and end with the same letter.
Find names/words (from a string) that start and end with the same letter.
- Case-insensitive.
- If a name/word is not at the end of the string, it can be followed by a white-space or a comma.
- Names/words contain only letters or dashes.
- Underscores are NOT considered as letters. Words separated by underscores count as distinct words, e.g. in 'NAN_CONST' the 'NAN' is matched.
- Words are at least two letters long, so e.g. 'a' is not matched.
Example:
in = 'Cedric loves regular expressions' out = {'Cedric', 'regular'}
Solution Stats
Problem Comments
-
3 Comments
Cedric
on 23 Mar 2013
I forgot, the "ans" trick when I ran the test function, so *** it is still possible to make it with size 12 and take the lead! ***
@bmtran (Bryant Tran)
on 23 Mar 2013
does the word "a" in the second test suite not meet the requirements?
Cedric
on 23 Mar 2013
That's a good point. It does not, because I assumed words to be at least two letters, but I should put this information in the statement!
Solution Comments
Show commentsProblem Recent Solvers36
Suggested Problems
-
Which values occur exactly three times?
5088 Solvers
-
Project Euler: Problem 5, Smallest multiple
1338 Solvers
-
Calculate the area of a triangle between three points
2939 Solvers
-
Sum the numbers on the main diagonal
581 Solvers
-
654 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!