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
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónVisible tests
1
Input
"hello world"Expected
"Hello World"2
Input
"the QUICK brown"Expected
"The Quick Brown"3
Input
"python"Expected
"Python"4
Input
""Expected
""5
Input
"a b c"Expected
"A B C"6
Input
"ROSETTA code"Expected
"Rosetta Code"Focus radio
Paused · SomaFM · Fluid