Anda di halaman 1dari 1

A CHARACTER TRANSLATION

Input File: chart.in

CAOS (Computer Aid for Office Security) is developing an encoding system to protect text files. The
designed encoding is based on a character translation map, defined by a set of pairs
{(a1,b1), (a2,b2), ..., (aM,bM)}

where aj, bj are characters of the English alphabet , 1≤j≤M. The encoding of a given text is the
same text where each aj is replaced by the corresponding bj. The replacements should be carried
simultaneously.

For instance: With the character translation map


{(m,d),(e,i),(s,r),(d,e),(y,s),(n,s),(r,n)}
the text send more money is encoded to rise doni dosis.

CAOS asked you to write a program to accomplish text encoding as explained. Your program
receives a character translation map and a text to be translated.

INPUT

Input consists of N test cases (1≤N≤10). The number N is given in the first line of the input file.

Each test case is defined with


• a line with s, a string of non repeated characters of the english alphabet (a..z)
• a line with a string t, of the same length than s
• a line with a text that must be encoded

The character translation map of the test case is defined by


{(s1,t1),(s2,t2),... (sj,tj),...}
where sj and tj are the j-th characters of the strings s and t.

OUTPUT

For each analyzed case one output line. Cases must be answered in the same order that were
presented. The output line of a test case is the corresponding encoded text.

SAMPLE INPUT
2
mesdynr
diressn
send more money
abcd
baca
abracadabra barba

OUTPUT FOR THE SAMPLE INPUT


rise doni dosis
barbcbabarb abrab

a – Character Translation 1/1

Anda mungkin juga menyukai