Clean Title Case
This kind of formatting is often used for article titles, book names, and UI cards. Write title_case, which turns the string title into a clean title: each word starts with a capital letter, except words listed in minor. The first word must always start with a capital letter, even if it appears in minor, and the original casing should be ignored.
Примеры
Ввод
"a clash of KINGS", "a an the of"Вывод
"A Clash of Kings"Ввод
"THE WIND IN THE WILLOWS", "The In"Вывод
"The Wind in the Willows"Ввод
"the quick brown fox"Вывод
"The Quick Brown Fox"Нужно реализовать
def title_case(title: str, minor: str = '') -> str:
Теги
strings
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięTests12
Visible tests
Ukryty test 7
Ukryty test 8
Ukryty test 9
Ukryty test 10
Ukryty test 11
Ukryty 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