#C63. Capitalize Words
Capitalize Words
Capitalize Words
Given a string, transform it such that each word in the string is capitalized, i.e. the first letter of each word is in uppercase and the rest of the letters in the word are in lowercase.
For example, given the string hello world
, the output should be Hello World
and for javaScript is amazing
, the output should be Javascript Is Amazing
.
This problem requires you to parse the input string and adjust the case of each word accordingly. Words are defined as sequences of non-space characters separated by one or more white spaces.
The conversion formula for each word is given by the transformation: \[ word \rightarrow \text{Uppercase}(word[0]) + \text{Lowercase}(word[1 \ldots end]) \]
inputFormat
Input is given via standard input (stdin) as a single line containing a string.
outputFormat
Output the transformed string via standard output (stdout) where each word has its first letter capitalized and the remaining letters in lowercase.## sample
hello world
Hello World