Problème
Afficher la traductionConvert text to title case: the first letter of every word becomes uppercase and the remaining letters lowercase. Words are separated by single spaces.
Implement title_case(text).
Input
text: Lowercase or mixed-case words separated by single spaces.
Output
Return the title-cased text.
Contraintes
0 ≤ length ≤ 10,000 (letters and spaces)
Exemples
Entrée :
text = "hello world"
Sortie attendue :
expected = "Hello World"
Entrée :
std::string text = "hello world";
Sortie attendue :
std::string expected = "Hello World";
Entrée :
string text = "hello world";
Sortie attendue :
string expected = "Hello World";
Explication
"hello" → "Hello" and "world" → "World".
Entrée :
text = "tHE qUICK fox"
Sortie attendue :
expected = "The Quick Fox"
Entrée :
std::string text = "tHE qUICK fox";
Sortie attendue :
std::string expected = "The Quick Fox";
Entrée :
string text = "tHE qUICK fox";
Sortie attendue :
string expected = "The Quick Fox";
Explication
Remaining letters become lowercase: "The Quick Fox".
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.