Advertisement
GeorgiLukanov87

08. Decipher This!

Jun 17th, 2022
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. secret_message = input().split()
  2. formated_message = []
  3. for word in secret_message:
  4.     digits_word = ""
  5.     rest_word = ""
  6.     for letter in range(len(word)):
  7.         if word[letter].isdigit():
  8.             digits_word += word[letter]
  9.         else:
  10.             rest_word += word[letter]
  11.     formated_message.append(chr(int(digits_word)) + rest_word)
  12. result = []
  13. for code in formated_message:
  14.     code = list(code)
  15.     code[1], code[-1] = code[-1], code[1]
  16.     result.append(''.join(code))
  17. print(' '.join(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement