#K91992. Capitalize Words in a String

    ID: 38098 Type: Default 1000ms 256MiB

Capitalize Words in a String

Capitalize Words in a String

You are given a string consisting of words separated by spaces. Your task is to transform the string so that for any word containing only alphabetical characters, the first letter is capitalized and the remaining letters are converted to lowercase. Words that include any non-alphabetical characters should remain unchanged.

For example:

  • The word hello becomes Hello.
  • The word WORLD becomes World.
  • The word w0rld! remains w0rld! because it contains non-alphabetical characters.

Note: The input is provided from standard input (stdin) and the output should be printed to standard output (stdout).

inputFormat

The input consists of a single line containing a string S where words are separated by spaces. The string may be empty.

outputFormat

Output a single line which is the transformed version of the input string according to the rules described.

## sample
hello world
Hello World