You just got a job at CIA (Central Intelligence Agency) as a cyber security head and your first mission is to implement a
message encoding feature [encryption] to ensure the chat is private and secure with your associates in different countries.
You have a message, which is a string S with length N containing only lowercase English letters.
It should be encoded in two steps as follows:
1.Swap the 1st and 2nd 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.
2.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'.
The string produced in the second step is the encoded message.

Input Format:
Enter a single string S.
Output Format:
Print a single line containing one string - [The encoded message].
Sample Input:
Sample Output:

The original message is "akshaii". In the first step, we swap three pairs of letters (note that the last letter is not swapped), so it becomes "kahsiai".
In the second step, we replace the first letter ('k') by 'p', the second letter ('a') by 'z', and so on, so the resulting encoded message is "pzshrzr"

Test Cases:
Test case 1: codecell
Test case 2: hasbest
Test case 3: hackathon
The output of all the three test cases should be concatenated and displayed as a single string.

This challenge is worth 60 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us

Kunal Desai : 7715051136

Neelraj Patil : 9930671144

Privacy Policy