Problem A
Cypher Decypher

Princess Peach is trying to organize the armies of Mushroom Kingdom to repel Bowser’s attack. However, her orders keep getting intercepted by Bowser’s top spy Mr. L. Peach has tried multiple encryption methods, but Mr. L has cleverly decrypted all attempts. However, Peach’s espionage unit has just found out that Mr. L doesn’t know how to multiply numbers! They quickly designed a cypher to exploit this.
The MKIA (Mushroom Kingdom Intelligence Agency) has designed
the following mapping from numbers to characters:
-
For each character in the message, use the MKIA mapping to find its corresponding number.
-
Multiply that number with the corresponding digit in the secret number string.
-
Use the MKIA mapping to transform this result back into a character for the encrypted result.
Given a number string and a series of messages, return the encrypted messages after applying the previous algorithm.
Input
The first line is a sequence of digits representing the
multiplier in each position of the test cases. This has length
Output
Output
Sample Input 1 | Sample Output 1 |
---|---|
17247 2 HELLO WORLD |
HCWSU WUISV |
Sample Input 2 | Sample Output 2 |
---|---|
010281 3 THANKS TOJANE STREET |
AHAACS AOAAAE ATAIGT |
Sample Input 3 | Sample Output 3 |
---|---|
0102 8 ONEF ISHT WOFI SHRE DFIS HBLU EFIS HHHH |
ANAK ASAM AOAQ AHAI AFAK ABAO AFAK AHAO |