78. Capitalise Each Word
Core1000 ms256 MBSolved by 0%
Read one line and print it with the first letter of every word in uppercase and every other letter in lowercase.
A word starts after a space or at the beginning of the line. Spacing is preserved exactly as it was, including repeated spaces.
Constraints - The line has between 1 and 100000 characters. - Printable ASCII only.
Input
A single line of text.
Output
Print the line with the first letter of each word in upper case. Spacing is preserved exactly.
Inputhello world
OutputHello World
Noteis two lowercase words
InputhELLO wORLD
OutputHello World
Notehas mixed case and repeated spaces that must be preserved exactly
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.