Capitalize Words
Given a string s where words are separated by single spaces, capitalize the first letter of each word. Leave all other characters exactly as they are. This is like simple formatting for titles, names, or labels in text. Return the updated string.
Примеры
Ввод
"hello world"Вывод
"Hello World"Ввод
"the quick brown FOX"Вывод
"The Quick Brown FOX"Ввод
"a b c"Вывод
"A B C"Нужно реализовать
def capitalize_words(s: str) -> str:
Теги
strings
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
"hello world"Expected
"Hello World"2
Input
"the quick brown FOX"Expected
"The Quick Brown FOX"3
Input
"a b c"Expected
"A B C"4
Input
"abc"Expected
"Abc"5
Input
"ab"Expected
"Ab"6
Input
"HELLO WORLD"Expected
"HELLO WORLD"Focus radio
Paused · SomaFM · Fluid