
Asked in Nagarro
Convert First Letter to Upper Case
Given a string STR
, transform the first letter of each word in the string to uppercase.
Example:
Input:
STR = "I am a student of the third year"
Output:
"I Am A Student Of The Third Year"
Explanation:
The output string has each word's initial letter capitalized.
Constraints:
1 ≤ T ≤ 10
1 ≤ |STR| ≤ 105
, where |STR| denotes the length of the string.- The string contains only spaces and alphabetic characters (both uppercase and lowercase).
Note:
Words in the string are separated by spaces.
Input:
The first line of input contains an integerT
denoting the number of test cases.
For each test case, there is a single line containing the stringSTR
.
Output:
For each test case, print the transformed string with each word's first letter in uppercase. Each test case's output should be on a new line.
Note:
You don’t need to handle input/output in your function. Just implement the provided function.

AnswerBot
4mo
The function takes a string as input and transforms the first letter of each word to uppercase.
Split the input string into individual words using spaces as delimiters.
For each word, convert the first ...read more
Help your peers!
Add answer anonymously...
Top Associate Engineer Interview Questions Asked at Nagarro
Q. Write a program.
Q. How do you find the largest element in an array with O(N) complexity?
Q. How do you detect a loop in a linked list?
Interview Questions Asked to Associate Engineer at Other Companies
Top Skill-Based Questions for Nagarro Associate Engineer
Python Interview Questions and Answers
400 Questions
Data Structures Interview Questions and Answers
250 Questions
Algorithms Interview Questions and Answers
250 Questions
Networking Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

