Problem 217
Capitalize Each Word
Easy · 10 pts · String
Problem
You are given a sentence of English words separated by single spaces. Rewrite it so that every word starts with an uppercase letter and all the other letters of the word are lowercase, whatever their case was before. Print the converted sentence. Go through the characters: a letter that is first in the line or comes right after a space becomes uppercase, and every other letter becomes lowercase. Spaces stay as they are.
Input
A single line of English letters and single spaces.
Output
Print the converted sentence.
Constraints
1 <= length <= 100000
Example input
hELLO wORLD
Example output
Hello World
Explanation
"hELLO wORLD" has two words. hELLO becomes Hello and wORLD becomes World, so the result is Hello World.