The problem is simple you just have to encrypt a message using 2 keys.
You are given a message of length n, an integer key and a string key. First, add the integer key to every individual characters of the message. After that, the resulting encrypted message is represented using an integer matrix of order n*1. Representation will follow this pattern: A=0, B=1, C=2 and so on. Consider there are only capital letters in the message. Add the first key (Integer key) into the second key which is a (String(Upper Case)) of size n*n, and represent the resulting string into a matrix of order n*n in the same way the first decrypted message was represented. After that multiply this matrix with the first matrix and find the equivalent alphabet for each number in the product matrix. For better understanding, see the sample explanation section.
INPUT FORMAT
OUTPUT FORMAT
For each test case, print a single line containing the encrypted message
.CONSTRAINTS
Here the message is AAA
Integer key is 3
String key is ABCDEFGHI
When 3 is added to string AAA we get DDD. Equivalent matrix for 'DDD' will be:
3 |
3 |
3 |
The other key is ABCDEFGHI after adding the first key in it, the resulting string will be 'DEFGHIJKL', its equivalent matrix will be:
3 | 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 |
Multiplying these 2 matrices we will get
10 |
11 |
12 |
Whose equivalent alphabets are 'KLM', which is the encrypted message and thus the output.