Cryptoquote `- o6 q7 K q7 I- q* T; ^0 M! s1 b# R# Y/ Q6 O7 w
2 W0 {, l+ l% t3 e+ I
Time Limit: 1000 ms Memory Limit: 65536 kB 2 v! w8 N7 \1 x* O# |& Z L% ^/ nSolved: 79 Tried: 281 u" [2 J- F) L3 g+ P. N$ u3 y' j
# H6 E# |1 b+ @: H, Q8 jDescription ; E' Y0 R1 ]9 }' C p& rA cryptoquote is a ** encoded message where one letter is simply replaced by another throughout the message. For example:1 N" h) `$ r6 w0 {& V' m
2 M3 i2 g! J- h! [; l0 cEncoded: HPC PJVYMIY ' V0 P5 c0 B$ K* f& s5 t& I
Decoded: ACM CONTEST 2 q/ ^/ [ |0 ]& }4 _; U. H . K% G. C8 N' a- YIn the example above, H=A, P=C, C=M, J=O, V=N, Y=T, M=E and I=S. For this problem, you will decode messages. 0 d R' c7 |: |
- N# M6 ^5 i9 X* F7 m2 L. _/ y/ R & \5 ^6 K+ p( J) D+ IInput ' L! ^; i& c/ q3 E
The first line of input contains a single integer N,(1<=N<=1000) which is the number of data sets that follow. Each data set consists of two lines of input. The first line is the encoded message. The second line is a 26 character string of upper case letters giving the character mapping for each letter of the alphabet: the first character gives the mapping for A, the second for B and so on. Only upper case letters will be used. Spaces may appear in the encoded message, and should be preserved in the output string. ( l& f9 B( w1 h, \+ L+ r+ Q# w4 L ; l5 W7 v ^, L+ H0 I: [* e& n 4 Y5 W# M5 n: Q& h 4 g, F& ^7 a% A1 nOutput 9 U0 ]2 \1 D( ~/ U7 ^For each data set, you should generate one line of output with the following values: The data set number as a decimal integer (start counting at one), a space and the decoded message. V+ b$ e9 r8 n( O
0 }" k4 M8 o8 ^2 T 1 T+ v3 A- q5 Q: H4 oSample Input 2 a& j9 h5 ^) m2 D$ N5 ?0 U
2 8 R- o+ a; y$ r- N7 O( d' y% sHPC PJVYMIY $ F; W7 j/ N7 V' L% g4 q$ o% D* {
BLMRGJIASOPZEFDCKWYHUNXQTV 3 F$ Z) E. ?- [& |( o, W+ i0 M* S! JFDY GAI BG UKMY 9 [- j9 E; J# d# R9 lKIMHOTSQYRLCUZPAGWJNBVDXEF$ P' d8 t, k. U3 n/ b; H
8 V: I, C3 `( J0 \, W! t
8 Q: G7 e: D' H Q" v0 Z " X' \5 b5 w4 z8 hSample Output 8 S. \; B9 h# [" f0 C1 ACM CONTEST % ?; I& S0 c0 s9 l) x2 N8 P9 ? e2 THE SKY IS BLUE) R+ q F! D) M( T% l1 |