MCIPC Contest 1 P1 - Cypher

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

BAC and SAC are at war!

You, an intelligence officer, are tasked with deciphering encrypted messages that were intercepted from the belligerent club.

You know that the enemy uses a very simple encryption system. First, they will get any ordinary string that is N characters long consisting of only uppercase letters and then scramble it. To unscramble the message, the receiver will use a cypher to decrypt the message. The cypher is simply a list of numbers which provide the original order the scrambled letters appeared in.

Fortunately, you just so happen to have that cypher in your possession, all that is left is to decrypt the message.

Constraints

1 \leq N \leq 10^5

Subtask 1 [50%]

1 \leq N \leq 10^3

Subtask 2 [50%]

No additional constraints.

Input Specification

The first line of input will contain N.

The second line of input will contain N uppercase letters, each separated by a space.

The third line of input will contain a permutation of the first N positive integers.

Output Specification

Output the original unscrambled message.

Sample Input

6
M O A U S G
2 3 1 5 6 4

Sample Output

AMOGUS

Comments

There are no comments at the moment.