#K64432. Pluralizing Nouns with Suffix Rules
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 endingy
withies
. 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
, orz
, appendes
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:
- The first line contains an integer \(N\) representing the number of words.
- 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.
## sample4
city
fox
bus
chair
cities
foxes
buses
chairs
</p>