HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50829 - Decode an Image

Guest
• Review clarifications (1)

Section problems

• 51126 - Dr. Fllanxha
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50990 - Two Neighbors
• 50496 - Falling Bricks
• 51021 - Number of Nodes
• 50829 - Decode an Image
• 51044 - Number of Trees
• 50876 - He is my cousin
• 51098 - Rotate a matrix
• 50838 - Balanced Numbers
• 50851 - Repeated Numbers
• 51061 - The Longest Path
• 51083 - Grades Histogram
• 51084 - Reflect a matrix

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Decode an Image

You will be given encoding of an image. And that will be followed by the image itself. Decode and show it.

Input specification
In the first line, you will be given an integer: The number of codes(n) where 0 ≤ n ≤ 2000. Then, in the following n lines, you will be given:

  • The name of pattern: at most 12 chars string
  • The code: At most 25 char string containing only 1 or 0
Then, you will be given an integer (k) the number of lines. In the following k lines you will be given the image where k is not greater than 500 and in every line you have at most 150 ones or zeros.

Output specification:
Show decoded image.

Sample Input I
4
as 1
bd 01
c 001
d 000
3
10010
10101
01000
Sample Output I
as c bd bd bd bd d



Для отправки решений необходимо выполнить вход.

www.contester.ru