#K64432. Pluralizing Nouns with Suffix Rules

    ID: 31974 Type: Default 1000ms 256MiB

Pluralizing Nouns with Suffix Rules

Pluralizing Nouns with Suffix Rules

Given a list of singular English nouns, convert each noun into its plural form following these rules:

  • If a word ends with y preceded by a consonant, replace the ending y with ies. Formally, if a word \(w\) satisfies \(w = xcy\) where \(c\) is a consonant, then its plural is \(xcies\).
  • If a word ends with any of s, sh, ch, x, or z, append es to form its plural.
  • In all other cases, append s to form the plural.

You are required to implement a program that reads an integer \(N\) and then \(N\) words (each on a new line) from the standard input, and prints the plural forms of each word on a separate line to the standard output.

inputFormat

The input is read from stdin and has the following format:

  1. The first line contains an integer \(N\) representing the number of words.
  2. The next \(N\) lines each contain a single word consisting of lowercase letters.

outputFormat

The output should be written to stdout and consist of \(N\) lines, where each line contains the plural form of the corresponding input word.

## sample
4
city
fox
bus
chair
cities

foxes buses chairs

</p>