#t123. 数字加密
数字加密
Digit Encryption
Problem Description
Xiaoyang has a string of digits and wants to turn it into another string of digits; this process is called encryption.
He has a codebook that tells him: which digit each digit should become.
There are digits in total: .
The codebook tells, in order:
- what should become
- what should become
- what should become
- what should become
Please replace every digit of the original string with the new digit according to the codebook, and output the result.
Input Format
The input consists of lines in total.
- The first line: an integer, the number of digits to be encrypted.
- The second line: the digits to be encrypted, separated by spaces.
- The third line: the codebook, space-separated digits in total.
The meaning of these digits is:
- the 1st digit: what becomes after encryption;
- the 2nd digit: what becomes after encryption;
- the 3rd digit: what becomes after encryption;
- the 10th digit: what becomes after encryption.
Output Format
Output the encrypted digits, separated by spaces.
That is: replace each digit in the second line of input by the corresponding digit in the third line, then output.
Sample Input
7
0 2 0 3 4 1 9
9 0 1 2 3 4 5 6 7 8
Sample Output
9 1 9 2 3 0 8
Sample Explanation
The digits to be encrypted in the second line are, in order: .
The codebook in the third line is, in order: .
Its meaning is:
- becomes
- becomes
- becomes
- becomes
- becomes
- becomes
- becomes
- becomes
- becomes
- becomes
Therefore, according to the mapping:
- the 1st digit becomes
- the 2nd digit becomes
- the 3rd digit becomes
- the 4th digit becomes
- the 5th digit becomes
- the 6th digit becomes
- the 7th digit becomes
The resulting encrypted digits are, in order: , output separated by spaces.
Constraints
The number of digits to be encrypted does not exceed , and each digit is between and ; the digits in the codebook are distinct and are all between and .