Encoded Meassage

Chef has a message, which is a string S with length N containing only lowercase English letters. It should be encoded in two steps as follows:

Swap the first and second character of the string S, then swap the 3rd and 4th character, then the 5th and 6th character and so on. If the length of S is odd, the last character should not be swapped with any other.
Replace each occurrence of the letter ‘a’ in the message obtained after the first step by the letter ‘z’, each occurrence of ‘b’ by ‘y’, each occurrence of ‘c’ by ‘x’, etc, and each occurrence of ‘z’ in the message obtained after the first step by ‘a’.

What is your question exactly?

1 Like