Programming contests

DEIK Regionális Programozó Csapatverseny, középiskolai kategória, 2015. november 29.

November 29, 2015, 10:40 AM – November 29, 2015, 3:40 PM

Babelfish

You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.

Input Specification

The input consists of up to 100 000 dictionary entries, followed by a blank line, followed by a message of up to 100 000 words. Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word appears more than once in the dictionary. The message is a sequence of words in the foreign language, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters.

Output Specification

The output is the message translated to English, one word per line. Foreign words not in the dictionary should be translated as “eh”.

Sample Input

  1. dog ogday
  2. cat atcay
  3. pig igpay
  4. froot ootfray
  5. loops oopslay
  6. atcay
  7. ittenkay
  8. oopslay
download as text file

Output for Sample Input

  1. cat
  2. eh
  3. loops
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024