문제
번역본 보기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에 맞게 수정되었습니다. 위의 설명과 제한 조건을 따르세요.