#C11429. Capitalize Words

    ID: 40744 Type: Default 1000ms 256MiB

Capitalize Words

Capitalize Words

You are given a sentence that contains lowercase English letters and spaces. Your task is to transform the sentence so that the first letter of each word is capitalized. In other words, for every word in the sentence, convert its first letter to uppercase while leaving the other letters unchanged.

Note that the sentence may contain extra spaces at the beginning, in between words, or at the end. These extra spaces should be ignored when capitalizing the words, and the output should display words separated by a single space.

inputFormat

A single line is provided as input from STDIN containing a sentence with lowercase English letters and spaces. The sentence may have leading, trailing, or multiple spaces between words.

outputFormat

Output a single line to STDOUT with the sentence transformed such that the first letter of each word is capitalized and words are separated by a single space.## sample

hello world
Hello World