0% found this document useful (0 votes)
37 views

A Character Translation: Input File: Chart - in

The document describes a program that encodes text by replacing characters based on a character translation map. The program takes a character translation map defined by pairs of characters and a text as input. It outputs the encoded text where each character in the text is replaced by the corresponding character in the translation map pairs. The document provides an example input and output to illustrate how the program works.

Uploaded by

Samira
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

A Character Translation: Input File: Chart - in

The document describes a program that encodes text by replacing characters based on a character translation map. The program takes a character translation map defined by pairs of characters and a text as input. It outputs the encoded text where each character in the text is replaced by the corresponding character in the translation map pairs. The document provides an example input and output to illustrate how the program works.

Uploaded by

Samira
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like