Alice Catherine Morris and her sister Irene Barbara frequently send each other e-mails. Ever wary of interceptions and wishing to keep their correspondence private, they encrypt their messages in two steps. After removing all nonalphabetic characters and converting all letters to upper case, they: 1)replace each letter by the letter s positions after it in the alphabet (1 <= s <= 25)|we call this a shift by s-and then, 2) divide the result of step 1 into groups of m letters and reverse the letters in each group (5 <= m <= 20). If the length of the message is not divisible by m, then the last k (less than m) letters are reversed. For example, suppose s = 2 and m = 6. If the plaintext were
Meet me in St. Louis, Louis.
after removing unwanted characters and changing to upper case we get
MEETMEINSTLOUISLOUIS
We will call this the modified plaintext. We then shift each letter by 2 (Y would be replaced with A and Z would be replaced by B, here), getting the intermediate result:
OGGVOGKPUVNQWKUNQWKU
And finally reverse every group of 6 letters:
GOVGGOQNVUPKWQNUKWUK
Note the last two letters made up the last reversed group. As is customary, we write the result in groups
of 5 letters. So the ciphertext would be:
GOVGG OQNVU PKWQN UKWUK
Alas, it's not so hard to find the values for s and m when the ciphertext is intercepted. In fact it's even easier if you know a crib, which is a word in the modified plaintext. In the above example, LOUIS would be a crib. Your job here is to find s and m when presented with a ciphertext and a crib.