Dễ 0 đã giải Tỷ lệ chấp nhận 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.

Ràng buộc

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

Ví dụ

Ví dụ 1
Đầu vào:
text = "hello world"

Kết quả mong đợi:
expected = "Hello World"
Đầu vào:
std::string text = "hello world";

Kết quả mong đợi:
std::string expected = "Hello World";
Đầu vào:
string text = "hello world";

Kết quả mong đợi:
string expected = "Hello World";

Giải thích

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

Ví dụ 2
Đầu vào:
text = "tHE qUICK fox"

Kết quả mong đợi:
expected = "The Quick Fox"
Đầu vào:
std::string text = "tHE qUICK fox";

Kết quả mong đợi:
std::string expected = "The Quick Fox";
Đầu vào:
string text = "tHE qUICK fox";

Kết quả mong đợi:
string expected = "The Quick Fox";

Giải thích

Remaining letters become lowercase: "The Quick Fox".

Tham khảo

Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.

Học hỏi từ người khác

Giải pháp cộng đồng

Chưa có giải pháp nào được chia sẻ. Hãy giải thử thách này để đăng giải pháp đầu tiên.