#C6334. Capitalize the First Letter of Each Word

    ID: 50083 Type: Default 1000ms 256MiB

Capitalize the First Letter of Each Word

Capitalize the First Letter of Each Word

Given a sentence as input, your task is to transform the sentence by capitalizing the first letter of each word while leaving the remaining characters unchanged.

Words are defined as sequences of characters separated by spaces. If a word starts with a non-alphabet character, it remains unchanged.

For example:

  • Input: hello world → Output: Hello World
  • Input: let's code → Output: Let's Code
  • Input: 123easy as1 2,3. → Output: 123easy As1 2,3.

Note: The behavior follows the simple rule: for each word \(w\), if \(w = c + r\) where \(c\) is the first character and \(r\) is the remainder, then output the word as \(\text{toupper}(c) + r\). (Here, \(\text{toupper}(\cdot)\) is the function that converts a letter to uppercase.)

inputFormat

The input consists of a single line containing the sentence to be transformed. The sentence may include letters, digits, spaces, and punctuation marks.

outputFormat

Output a single line: the sentence after converting the first letter of each word to uppercase.

## sample
hello world
Hello World