P6401 [COCI 2014/2015 #2] MOBITEL
Description
Marko the grasshopper is happily jumping around in the meadow. By accident, his mobile phone fell into a puddle. Now the phone’s keypad has gotten wet, and the way the keys work is completely unpredictable! All the number keys are broken. When we press one key, the phone behaves as if we pressed a different key. Luckily, no two keys produce the same effect, so Marko can still type all letters.
Marko the grasshopper is doing some experiments to find out what each key does. Now he wants to write a letter to his girlfriend. Because he is only a grasshopper, he needs your help.
For those who do not remember how phone keys work, here is a short description.

This picture shows the keys with letters that we can get by pressing that key (on a working phone that did not fall into a puddle). For example, if we want the letter `a`, we press key 2 once, and if we want the letter `b`, we press key 2 twice. If we want to type two letters in a row using the same key, we must press `#` once. For example, to type the string `klor`, we press the keys in the following order: `55#555666777`.
Input Format
The first line contains $9$ integers. The first integer means that pressing key `1` has the same effect as which original key, the second means that pressing key `2` has the same effect as which original key, the third means that pressing key `3` has the same effect as which original key, and so on. Marko will not use the `*` and `0` keys. The `#` key will not break.
The second line contains a string $s$ consisting only of lowercase English letters, representing the string that Marko the grasshopper wants to type.
Output Format
The first and only line outputs the sequence of key presses needed to type the string Marko wants.
Explanation/Hint
#### Explanation for Sample 1
All key functions are shifted one position to the right, so the output is slightly different from the example sequence in the statement.
#### Constraints
Let $|s|$ be the length of string $s$. For $100\%$ of the testdata, $1\le |s|\le 100$.
#### Note
**This problem is translated from [COCI2014-2015](https://hsin.hr/coci/archive/2014_2015/) [CONTEST #2](https://hsin.hr/coci/archive/2014_2015/contest2_tasks.pdf) _T1 MOBITEL_.**
Translated by ChatGPT 5