favorite We need a little bit of your help to keep things running, click on this banner to learn more

Mysterious Note

Mysterious Note

prb378 Recently, Masha and Katya have learned that there is evil in the world of hackers, which can easily reveal the strange correspondence. So they decided to send only encrypted messages. For this purpose, friends began to use the permutation code, where each letter is replaced by another. For example:

Encoded message: HPC PJVYMIY

Decode the message: ACM CONTEST

In this example, the following replacement: H = A, P = C, C = M, J = O, V = N, Y = T, M = E and I = S.

In order not to engage in hand-coding and decoding, a friend asked you to write the program. Help girls!


In the first line of input is written coded message. Second line - 26 Latin uppercase letters representing the code for the corresponding symbol alphabet: the first character gives the code for A, B for second and so on. To be used only uppercase letters. In an encoded message may appear gaps that must be stored in the output string.


In the output file display one line, which contains the decoded message.
Time limit 1 second
Memory limit 64 MiB
Input example #1
Output example #1
Source Отборочный тур Всероссийской командной олимпиады школьников 2009/2010 учебный год