#K68152. String Formatting Challenge

    ID: 32801 Type: Default 1000ms 256MiB

String Formatting Challenge

String Formatting Challenge

In this problem, you are given a string which may contain multiple spaces between words and letters in mixed case. Your task is to format this string such that:

  • Each word’s first character is in uppercase and the remaining characters are in lowercase.
  • Words are separated by exactly one space (i.e. extra spaces are removed).

For example, the input "heLLo woRLD Code in PYTHON" should be converted to "Hello World Code In Python".

Pay attention to leading and trailing spaces as well. Your solution should read input from standard input (stdin) and print the result to standard output (stdout).

inputFormat

The input consists of a single line, which is a string that may contain extra spaces and letters in mixed case.

outputFormat

Output the formatted string such that each word starts with an uppercase letter, all other letters are lowercase, and words are separated by exactly one space.

## sample
heLLo  woRLD    Code     in   PYTHON
Hello World Code In Python