Author: | И. Блинов | Time limit: | 5 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
Petya does not cope well with the pronunciation of English words; he especially struggles with placing stress on correct vowels. Therefore, he decided to download the dictionary of English words with stresses and to write a program for placing stresses in words, based on the dictionary data. The dictionary contains N lines, each line of the dictionary consists of a word and a stressed word, separated by a comma and a space.
The dictionary has a number of features: the word can have a main variant of stress (indicated by the character '
) and zero or more additional variants of stress (indicated by the character "
). Petya is only interested in the main stress variant. There are also errors in the dictionary, namely: main or additional stress variants can indicate a consonant. When seeing an error, Petya does not trust the dictionary and the program should output a string NO
for this word.
The vowels are: a, e, i, o, u, y. The remaining letters are consonants.
Your program should process K words and output each word with the main stress (the stressed letter should be capitalized) or NO
, if the stress is not correct in the dictionary or the word is not in the dictionary.
The first line of the input file contains two integers NK. Following N lines contain a dictionary description. The following K lines contain words to put stresses into.
1≤N,K≤500
The sum of the lengths of all lines does not exceed 4⋅104.
All strings contain lowercase Latin letters and the following characters: ,
'
"
.
It is guaranteed that each word have exactly one main stress and all characters indicating stresses are strictly after the stressed letters.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|