当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3366: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:

  1. If the word is in the list of irregular words replace it with the given plural.
  2. Else if the word ends in a consonant followed by "y", replace "y" with "ies".
  3. Else if the word ends in "o", "s", "ch", "sh" or "x", append "es" to the word.
  4. Else append "s" to the word.
输入解释

The first line of the input file consists of two integers L and N (0 ≤ L ≤ 20, 1 ≤ N ≤ 100). The following 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 N lines contain one word each, which you have to make plural. You may assume that each word consists of at most 20 lowercase letters from the English alphabet ('a' to 'z').

输出解释

Print N lines of output, where the ith line is the plural form of the ith input word.

输入样例
3 7
rice rice
spaghetti spaghetti
octopus octopi
rice
lobster
spaghetti
strawberry
octopus
peach
turkey
输出样例
rice
lobsters
spaghetti
strawberries
octopi
peaches
turkeys

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Ulm Local 2007

源链接: POJ-3366

最后修改于 2020-10-29T06:59:45+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536