P29372 [洛谷] [COCI2014-2015#2] MOBITEL
普及
题目描述

Problem Description

Grasshopper Marko is happily hopping around in the meadow. Unfortunately, he drops his phone into a puddle. Now, the keys on his phone are wet and their functionality is completely unpredictable! All the number keys are malfunctioning. When we press one of these keys, the phone behaves as if we pressed a different key. Fortunately, no two keys behave the same way, so Marko can still write out all the letters.

Grasshopper Marko is conducting experiments to figure out the function of each key. Now he wants to write a letter to his girlfriend. Since he is just a grasshopper, he needs your help.

For those who don't remember how the phone keys work, here's a brief description.

This image shows the letters we can get by pressing that key (on a working phone that hasn't fallen into a puddle). For example, if we want the letter a, we press the 2 key once, and if we want the letter b, we press the 2 key twice. If we want to write two letters consecutively with the same key, we must press the # key once. For example, to type the string klor, we press the keys in the following sequence: 55#555666777.

Input Format

The first line of input contains 9 integers. The first integer indicates which key the 1 key now behaves like, the second integer indicates which key the 2 key now behaves like, and so on. Marko will not use the * and 0 keys. The # key will not malfunction.

The second line of input contains a string $s$, which consists only of lowercase letters from the English alphabet, representing the string that Grasshopper Marko wants to type out.

Output Format

The first and only line of output should contain the sequence of keys needed to print out the string that Grasshopper Marko wants.

Sample Input and Output

Sample Input #1

2 3 4 5 6 7 8 9 1
klor

Sample Output #1

44#444555666

Sample Input #2

7 8 9 1 2 3 6 5 4
djevojka

Sample Output #2

68662227778#885

Sample Input #3

9 8 7 6 5 4 3 2 1
skakavac

Sample Output #3

33335585582228#888

Notes

Sample 1 Explanation

All keys are shifted one position to the right, hence the output is slightly different from the example in the problem statement.

Data Size and Constraints

Let $|s|$ be the length of the string $s$. For $100\%$ of the data, it is guaranteed that $1 \le |s| \le 100$.

Notes

This problem is translated from COCI2014-2015 CONTEST #2 T1 MOBITEL.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3 4 5 6 7 8 9 1 klor
样例输出
44#444555666