Programming contests

DEIK Regionális Programozó Csapatverseny, egyetemi kategória, 2023. december 3.

December 3, 2023, 10:00 AM – December 3, 2023, 3:30 PM

Metro

The yearly programming contest at the Faculty of Informatics is getting more and more popular, thus the politicians managing our city decided that they intend to build a direct metro-line between the train station and the Faculty. At this metro station there is a digital info board which is able to provide us with useful messages, advertisements, etc. Your task is to draw out the message on this board as a so-called "ASCII art". For this you are provided the ASCII art of every letter in the english alphabet including the ? character and the text what you need to draw.

Input

The input has four parts:

  • the first line tells us the width l of each letter
  • the second line tells us the height h of each letter
  • the third line contains the t text what you should output. In this text there can be letters which are not part of the english alphabet. The text is case-insensitive, so e.g. a==A.
  • the next h lines are the ASCII art representation of the capital letters of the english alphabet and the ? character. Each line has a width of 27*l end every line contains 1-1 line of each of the characters (so for example line 0 contains the 0th line of ABCD...XYZ?). The ASCII-art letters are not separated from each other by default, however in the ASCII art there can be empty spaces.

Output

The output is the ASCII art of the given t text. Every character which is not part of the english alphabet must be represented with the ASCII art of the ? character.

Restrictions

  • l is between 0 and 30
  • h is between 0 and 30
  • t has at most 200 characters

Example

Input:
  1. 4
  2. 5
  3. hElLo4
  4.  #  ##   ## ##  ### ###  ## # # ###  ## # # #   # # ###  #  ##   #  ##   ## ### # # # # # # # # # # ### ### 
  5. # # # # #   # # #   #   #   # #  #    # # # #   ### # # # # # # # # # # #    #  # # # # # # # # # #   #   # 
  6. ### ##  #   # # ##  ##  # # ###  #    # ##  #   ### # # # # ##  # # ##   #   #  # # # # ###  #   #   #   ## 
  7. # # # # #   # # #   #   # # # #  #  # # # # #   # # # # # # #    ## # #   #  #  # # # # ### # #  #  #       
  8. # # ##   ## ##  ### #    ## # # ###  #  # # ### # # # #  #  #     # # # ##   #  ###  #  # # # #  #  ###  #  
download as text file Output:
  1. # # ### #   #    #  ### 
  2. # # #   #   #   # #   # 
  3. ### ##  #   #   # #  ## 
  4. # # #   #   #   # #     
  5. # # ### ### ###  #   #  
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024