#K62587. Name Normalization

    ID: 31564 Type: Default 1000ms 256MiB

Name Normalization

Name Normalization

Given a list of names, write a program to normalize each name by capitalizing the first letter of each word and converting the remaining letters to lowercase. The input starts with an integer n representing the number of names, followed by n lines, each containing a name. Words in a name are separated by a single space. Notice that hyphenated words should be treated as a single word, i.e., only the first character is capitalized and the rest are lowercase.

For example:

  • "alice smith" becomes "Alice Smith".
  • "JOHN DOE" becomes "John Doe".
  • "aVA bRoWN" becomes "Ava Brown".
  • "mary-jane" becomes "Mary-jane".
  • "MARY bELLe" becomes "Mary Belle".

inputFormat

The first line contains an integer n (1 ≤ n ≤ 100) representing the number of names. Each of the following n lines contains a name, which may include spaces and hyphens.

outputFormat

Output n lines, each line containing the normalized name corresponding to the input order.

## sample
3
alice smith
JOHN DOE
aVA bRoWN
Alice Smith

John Doe Ava Brown

</p>