KIT - Krypt in Time
Krypt in Time
In a land far away people can travel back in time in person or send messages to them in the past. Sending messages that can change ones future is forbidden. The messages that are sent are intercepted by the time police. Jim wants to send a message to himself in the past to prevent his death. He decides to encrypt using a "number-pad". All the numbers in number-pad are between 0 and 25. The message he wants to send can be encrypted if each character in the string is encoded by a number from the pad provided each number from the number- pad is only used once. The encryption is done by shifting each letter in the message by k positions, where k is determined by the number-pad. Shift occurs between the alphabets "a" and "z". If a letter in the message is shifted past "z" then it starts back at "a" and continues to shift.
For example: If the number-pad contains 2, the message abc is transformed to cde and xyz to zab.
The first line will contain the size of the number-pad N, followed by a sequence of numbers for the pad. The remaining input consists of a series of words to be encrypted using the number-pad. You may assume that the maximum size of the pad (N) is 100 numbers, all numbers in the pad are between 0 and 25, and that all input will be lowercase letters. The end of input is indicated by -1.
For each word to be encrypted, output a line containing the encrypted word.
1 2 3 4 5 4 3 2 1 0
Poor description - it took me many WA to discover that the number pad can appear on multiple lines in the input.
silly mistake causes me 3 WA :'( ..btw easy one
@godfrey_17897 You probably haven't considered that there could be more than N letters
any special test cases ?
15007983, can you point out my mistake, I'm getting all cases correct.
Just Love encryption... :)
AC in one Go ,
why limit language?
.:: Jarv1s ::.:
Nice one, you rotate through Number pad until the input is all consumed.