Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. code = [x for x in input().split(" ")]
  2. ascii_number = []
  3. new_code = []
  4.  
  5. for x in code:
  6. word = [y for y in x]
  7. for y in word:
  8. if y.isdigit():
  9. ascii_number.append(y)
  10. else:
  11. break
  12. for z in ascii_number:
  13. word.remove(str(z))
  14.  
  15. ascii_word = chr(int(''.join(ascii_number)))
  16. new_code.append(str(ascii_word))
  17.  
  18. first_symbol = word[0]
  19. second_symbol = word[len(word) - 1]
  20. word.remove(first_symbol)
  21.  
  22. if len(word) > 0:
  23. word.remove(second_symbol)
  24. new_code.append(second_symbol)
  25.  
  26. new_code.extend(word)
  27. new_code.append(first_symbol)
  28.  
  29. new_code.append(" ")
  30. ascii_number.clear()
  31.  
  32. print(''.join(new_code))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement