## CCO '10 P6 - Shuffle

View as PDF

Points: 10
Time limit: 2.0s
Memory limit: 256M

Problem type
##### Canadian Computing Competition: 2010 Stage 2, Day 2, Problem 3

You want to keep some secrets, so you invent a simple encryption algorithm.

You will map each uppercase character and underscore to some other uppercase character and underscore. In other words, this is a permutation of the characters, or, to put it another way, you create a and onto map from to .

However, you will repeatedly apply this encryption in an attempt to make your message more secure.

#### Input Specification

The input will be 29 lines long. The first 27 lines will each contain a single character from the set . The first of these lines represents what the character A maps to, the second of these lines represents what the character B maps to, and so on, until the line represents what the underscore character maps to. On the line will be an integer which represents the number of times this encryption should be applied. On the line is , a string of less than 80 characters from the set .

#### Output Specification

On one line, output the string created after shuffling a total of times, using the given shuffle permutation.

#### Sample Input

B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
_
A
3
I_LOVE_THE_CCC

#### Sample Output

LCORYHCWKHCFFF

• Riolku  commented on Nov. 22, 2018, 9:08 a.m.

The CCC test data seems incorrect. Although they say that T will be less than 80 characters inspection of test data reveals that this is not the case.

• Xue_Alex  commented on June 15, 2017, 7:19 p.m.

to map from {A,B,…,Z,_}{A,B,…,Z,_} to {A,B,…,Z,_}{A,B,…,Z,_}.

Yes.

• TheZombieCloud  commented on June 14, 2017, 11:55 a.m.

Unique

Is every character's mapping unique? For example, some random character gets mapped to A, but another random character cannot get mapped to A.

• Xue_Alex  commented on June 14, 2017, 11:58 a.m.

Yes, each character's mapping is unique, if it weren't then some characters wouldn't be able to be mapped to.