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 90 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
Comments
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.
Yes, each character's mapping is unique, if it weren't then some characters wouldn't be able to be mapped to.