After successfully completing your search engine, you are put on a new job. It turns out a rival company is trying to steal your customers by providing direct links to your web pages from their web site. Your job is to encrypt your web pages so that only your web server can access them.
You remember that the ancient Romans used a Caesar cipher, where each letter is replaced by a letter k later in the alphabet (shifting it by k positions). Shifts occur in alphabetical order, between the letters ``a'' and ``z''. If a letter is shifted past ``z'', it starts back at ``a'' and continues shifting. For example, using a caesar cipher where k = 2, the word ``car'' is transformed into ``ect'', while the word ``yaz'' is shifted to ``zcb''.
You decide to go one better. Instead of shifting all letters by the same distance, you will shift each letter by a different amount, based on a code word. Each letter in the code word is converted into a shift amount, based on how many letters it is after ``a''. Text to be encrypted is then shifted by the amount of each letter in the keyword, repeating as necessary.
For instance, suppose your keyword is ``bad''. The shift amounts for the letters are then 1, 0, and 3, respectively. You would encrypt the string ``carrot'' as ``dausow'', shifting ``c'' by one, ``a'' by zero, and ``r'' by three letters, then repeating for ``r'', ``o'', and ``t''.
The input will begin with your keyword on a single line. It will then consist of a series of words to be encrypted using the keyword, each on a separate line. The input will be terminated by a line containing only -1. You may assume that the keyword and all input will be in lowercase.
For each word to be encrypted, output a line containing the encrypted word.
Input:
bad carrot aaaaa -1
Output:
dausow badba
Input:
umd mclj rizq -1
Output:
good luck
Input 1 | Output 1 |
---|---|
Input 2 | Output 2 |
Input 3 | Output 3 |
Input 4 | Output 4 |