Advertisement
Nenogzar

Untitled

Feb 14th, 2024
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. message = input().split()
  2.  
  3. words, numbers = [], []
  4. for word in message:
  5.     num, let = "", ""
  6.     for symbol in word:
  7.         if symbol.isdigit():
  8.             num += symbol
  9.         else:
  10.             let += symbol
  11.     numbers.append(int(num))
  12.     if len(let) != 1:
  13.         let = f"{let[-1]}{let[1:-1]}{let[0]}"
  14.     words.append(let)
  15.  
  16. for n, w in zip(numbers, words):
  17.     print(f"{chr(n)}{w}", end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement