eolymp
bolt
Try our new interface for solving problems
Məsələlər

Deli Deli

Deli Deli

Mrs. Deli is running the delicatessen store "Deli Deli". Last year Mrs. Deli has decided to expand her business and build up an online store. She has hired a programmer who has implemented the online store. Recently some of her new online customers complained about the electronic bills. The programmer had forgotten to use the plural form in case that an item is purchased multiple times. Unfortunaly the programmer of Mrs. Deli is on holiday and now it is your task to implement this feature for Mrs. Deli. Here is a description how to make the plural form: \begin{enumerate} \item If the word is in the list of irregular words replace it with the given plural. \item Else if the word ends in a consonant followed by "\textbf{y}", replace "\textbf{y}" with "\textbf{ies}". \item Else if the word ends in "\textbf{o}", "\textbf{s}", "\textbf{ch}", "\textbf{sh}" or "\textbf{x}", append "\textbf{es}" to the word. \item Else append "\textbf{s}" to the word. \end{enumerate} \InputFile The first line of the input file consists of two integers \textbf{l} and \textbf{n} (\textbf{0} ≤ \textbf{l} ≤ \textbf{20}, \textbf{1} ≤ \textbf{n} ≤ \textbf{100}). The following \textbf{l} lines contain the description of the irregular words and their plural form. Each line consists of two words separated by a space character, where the first word is the singular, the second word the plural form of some irregular word. After the list of irregular words, the following \textbf{n} lines contain one word each, which you have to make plural. You may assume that each word consists of at most \textbf{20} lowercase letters from the english alphabet ('\textbf{a}' to '\textbf{z}'). \OutputFile Print \textbf{n} lines of output, where the \textbf{i}-th line is the plural form of the \textbf{i}-th input word.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
3 7
rice rice
spaghetti spaghetti
octopus octopi
rice
lobster
spaghetti
strawberry
octopus
peach
turkey
Çıxış verilənləri #1
rice
lobsters
spaghetti
strawberries
octopi
peaches
turkeys
Mənbə University of Ulm Local Contest 2007.07.06