You must write a program that encrypts an input into a string of characters.
For every character
i in the input up to the second to last character, take the
i+1 characters and encode them by writing the letters of the alphabet, in order, that range in the same direction between those chosen characters.
For example: if the original string were
bo then it would be encoded as
cdefghijklmn, but if the string were
bo is encoded as
oa is encoded as
nmlkjihgfedcb with the final encrypted string being
If the original string contain zero letters between two chosen characters, such as the string
ab then you should encrypt it as
R standing for what direction in the alphabet to go in determining the original characters. The encrypted string
ab but the encrypted string
R = right,
L = left).
If two chosen characters in the original string are the same, such as the string
tt, then you should encrypt it as
Z standing for zero letters in between.
- You can write a program or a function.
- Your input may contain uppercase letters, so you need to put them all to lowercase before encrypting.
- You can ignore non-alphabet characters.
- One character length strings are undefined.
- Shortest code in bytes wins!