P14503 [GeeksforGeeks] Upper case conversion5419
普及-
题目描述

Given a string str, convert the first letter of each word in the string to uppercase.
Example 1:
Input:
str = "i love programming"
Output: "I Love Programming"
Explanation:
'I', 'L', 'P' are the first letters of
the three words.
Your Task:
You dont need to read input or print anything. Complete the function transform() which takes s as input parameter and returns the transformed string.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N) to store resultant string
Constraints:
1 <= N <= 10^{4}
The original string str only consists of lowercase alphabets and spaces to separate words.

输入格式

见题面

输出格式

见题面

样例输入
str = "i love programming"
样例输出
"I Love Programming"