Einfach 0 gelöst 0% Erfolgsquote

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.

Einschränkungen

0 ≤ length ≤ 10,000 (letters and spaces)

Beispiele

Beispiel 1
Eingabe:
text = "hello world"

Erwartete Ausgabe:
expected = "Hello World"
Eingabe:
std::string text = "hello world";

Erwartete Ausgabe:
std::string expected = "Hello World";
Eingabe:
string text = "hello world";

Erwartete Ausgabe:
string expected = "Hello World";

Erläuterung

"hello" → "Hello" and "world" → "World".

Beispiel 2
Eingabe:
text = "tHE qUICK fox"

Erwartete Ausgabe:
expected = "The Quick Fox"
Eingabe:
std::string text = "tHE qUICK fox";

Erwartete Ausgabe:
std::string expected = "The Quick Fox";
Eingabe:
string text = "tHE qUICK fox";

Erwartete Ausgabe:
string expected = "The Quick Fox";

Erläuterung

Remaining letters become lowercase: "The Quick Fox".

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.