Clean Title Text

This kind of transformation is useful for names, headings, and titles that users typed with mixed casing. Write a function title_case that receives a string s where words are separated by spaces. Make the first letter of each word uppercase and the remaining letters of that word lowercase. Keep the word order and the spaces between words unchanged.

Примеры

Ввод
"hello world"
Вывод
"Hello World"
Ввод
"the QUICK brown"
Вывод
"The Quick Brown"
Ввод
"python"
Вывод
"Python"

Нужно реализовать

def title_case(s: str) -> str:

Теги

strings
PostgreSQLv16

Tu sa zobrazí výsledok spustenia kódu

Tests12
Visible tests
Skrytý test 7
Skrytý test 8
Skrytý test 9
Skrytý test 10
Skrytý test 11
Skrytý test 12

They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.

Focus radio
Paused · SomaFM · Fluid