bounslay

Untitled

May 20th, 2023
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. usr_inp = input().split()
  2.  
  3. output = ''
  4. for word in usr_inp:
  5.     if len(word) >= 3:
  6.         for ch in word:
  7.             ch = ord(ch)+1
  8.             output += chr(ch)
  9.            
  10.     else:
  11.        
  12.         output += word  
  13.     output += ' '
  14.  
  15.  
  16. splited_output = output.split()
  17.  
  18. encoded_message = ''
  19. for word in splited_output:
  20.     if len(word) >= 3:
  21.         encoded_message += word[0]
  22.         encoded_message += str(len(word[1:-1]))
  23.         encoded_message += word[-1]
  24.         encoded_message += ' '
  25.     else:
  26.         encoded_message += word + ' '
  27.  
  28.  
  29. print(encoded_message)
Advertisement
Add Comment
Please, Sign In to add comment