Facile 0 résolus 0 % de réussite

Title Case

Capitalize the first letter of every word.

Convert 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

Exemple 1
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".

Exemple 2
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.

Apprenez des autres

Solutions de la communauté

Aucune solution publiée pour l'instant. Résolvez ce défi pour partager la première.