Initials of a phrase
- O(n) · Medium
- Full plan
- Python
- JavaScript
- strings
- lists
Problem
Write a function that takes a phrase and returns the first letter of each word, in capitals and all glued together: with "code a little every day" it returns "CALED". The words come separated by spaces, and extra spaces are ignored. An empty phrase returns the empty text.
Examples
"code a little every day" → "CALED"
"Hello world" → "HW"
"" → ""
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def phrase_initials(text):
passJavaScript
function phraseInitials(text) {
}Solve this challenge
It opens in your browser, with the editor and the tests. This challenge is part of the full plan; the O(1) and O(log n) ones are free.