[UVA] 11233 - Deli Deli
# /* 題目: UVa 11233 - Deli Deli
# * onlinejudge.org/external/112/11233.pdf
# * Language: Python
# * Created on: 2019年12月19日
# * Author: hanting
# */
dic = {}
L, N = map(int, input().split())
for i in range(L):
key, value = input().split()
dic[key] = value
for i in range(N):
key = input()
if key in dic:
print(dic[key])
else:
if key[-1] == 'y' and key[-2] not in ['a','e','i','o','u']:
print(key[:-1] + 'ies')
elif key[-1] == 'o' or key[-1] == 's' or key[-2:] == 'ch' or key[-2:] == 'sh' or key[-1] == 'x':
print(key + 'es')
else:
print(key + 's')
沒有留言:
張貼留言