Secret Message - 1
Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.
Input
The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output
The output should be a single line containing the secret message. All characters in the output should be in lower case.
Explanation
For example, if the given input is "python", "p" should replaced with "k", similarly "y" with "b", "t" with "g", "h" with "s", "o" with "l", "n" with "m". So the output should be "kbgslm".
Input 1:-
python
Output 1:-
kbgslm
Input 2:-
Foundations
Output 2:-
ulfmwzgrlmh
Input:-3
python learning
Output 3:-
kbgslm ovzimrmt
s = input()
result = ''
s1 = 'abcdefghijklm'
s2 = 'zyxwvutsrqpon'
for x in s:
if x.lower() in s1:
result = result + s2[s1.find(x.lower())]
elif x.lower() in s2:
result = result + s1[s2.find(x.lower())]
else:
result = result + x.lower()
print(result)
Comments
Leave a comment