Cryptoquote 9 d$ \+ `0 b' U' o W; s' z/ X1 u5 X3 d, g
' ? q8 t7 _; ]2 j; MTime Limit: 1000 ms Memory Limit: 65536 kB * O* g5 a m0 I1 E* d/ t% m+ oSolved: 79 Tried: 281 * S1 I2 }! M8 P r" h5 P
* B, z: c" y, Y7 \6 v% ]
Description " v1 x5 G. [$ D. \! t- cA cryptoquote is a ** encoded message where one letter is simply replaced by another throughout the message. For example: 8 d( g% b9 h4 f7 |& W8 N& ?5 r i) D& e. x6 U6 o1 D, g x# F5 Q
Encoded: HPC PJVYMIY ( k9 P- c+ F+ o$ \ iDecoded: ACM CONTEST 4 H7 S; G% e1 ^; M: x3 H 3 V7 t" G5 }# M4 E9 _5 a* A: TIn 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. . e, h# M* V' D2 t3 }
u, I, q$ ]0 I5 x/ Y( h6 f2 \4 z3 ?: s+ R! {
Input ?6 g7 S# F9 `5 {4 kThe 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. + t0 d. A* y7 g4 j( y( ]6 G d/ e! O
, C/ @% b) w8 e# u% | + P+ u' o, F4 BOutput 4 ?% O1 p' R3 Z0 G! |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. " o2 R2 y/ s+ e
2 s! D4 K& q" g( }( y