समस्या
अनुवाद दिखाएँ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)
उदाहरण
इनपुट:
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".
इनपुट:
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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।