Upper Case Conversion
Practice this coding question on Coding Gurukul.
Problem statement
A community noticeboard receives headings written with inconsistent word initials. Its formatter capitalizes the first letter of each word without changing the remaining letters. Your task Convert the first character of every space-separated word to uppercase. Important details Preserve all other letters exactly, even if they are uppercase already. Preserve every space, including repeated, leading, and trailing spaces. A word is a maximal nonempty run of English letters. Read the complete line instead of reading only its first token. Do not lowercase the rest of a word. Worked example The heading welcome to cG becomes Welcome To CG. The existing uppercase G stays uppercase.
Input format
One line of English letters and spaces, containing at least one letter.
Output format
Print the formatted line, preserving its spacing.
Constraints
1 <= line length <= 100000; spaces are ordinary ASCII spaces.
Sample input
welcome to cG
Sample output
Welcome To CG
Sign in to run or submit a solution in C++, Java or Python.