#K10576. Capitalize First Letter of Each Word

    ID: 23277 Type: Default 1000ms 256MiB

Capitalize First Letter of Each Word

Capitalize First Letter of Each Word

You are given an integer T representing the number of test cases. For each test case, you are provided with a string which may contain multiple spaces. Your task is to transform the string such that the first letter of each word is capitalized and the remaining letters are in lowercase.

Note: A word is defined as a sequence of characters separated by space(s). All spaces in the original string must be preserved.

For example, if the input is "hello world", the output should be "Hello World". If the input contains extra spaces, such as " hello world ", then the output must preserve these spaces: " Hello World "

inputFormat

The input is read from standard input and consists of:

  1. An integer T on the first line, representing the number of test cases.
  2. Then T lines follow. Each line contains a string.

outputFormat

For each test case, output the modified string on a new line where the first letter of each word is capitalized and the rest of the letters are in lowercase. All the spaces should remain unchanged.

## sample
1
hello world
Hello World