簡単 0件解決済み 正答率0%

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.

制約

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

例

例 1
入力:
text = "hello world"

期待される出力:
expected = "Hello World"
入力:
std::string text = "hello world";

期待される出力:
std::string expected = "Hello World";
入力:
string text = "hello world";

期待される出力:
string expected = "Hello World";

解説

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

例 2
入力:
text = "tHE qUICK fox"

期待される出力:
expected = "The Quick Fox"
入力:
std::string text = "tHE qUICK fox";

期待される出力:
std::string expected = "The Quick Fox";
入力:
string text = "tHE qUICK fox";

期待される出力:
string expected = "The Quick Fox";

解説

Remaining letters become lowercase: "The Quick Fox".

参考資料

この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。

他の人の解答から学ぶ

コミュニティの解答

まだ公開された解答がありません。この課題を解いて最初の解答を共有しましょう。