Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.
Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'.
a b c d e f g h i j k l m n o p q r s t u v w x y z
z y x w v u t s r q p o n m l k j i h g f e d c b a
The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output
All characters in the output should be in lower case.
Explanation
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".
Sample Input 1:
python
Sample Output 1 :
kbgslm
Input 2 :
Foundations
Output 2 :
ulfmwzgrlmh
s = (str(input("Enter String: "))).lower()
SecretCode = ""
letters = "abcdefghijklmnopqrstuvwxyz"
for r in range(0,len(s)):
SecretCode = SecretCode + str(letters[122-ord(s[r])])
print("Output String: :",SecretCode)
Comments
Leave a comment