Advertisement
viligen

immitation_game_2

Dec 1st, 2021
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. message = input()
  2.  
  3. while True:
  4.     command = input().split("|")
  5.     if "Decode" == command[0]:
  6.         break
  7.     elif "Move" == command[0]:
  8.         n = int(command[1])
  9.         message = message[n:] + message[:n]
  10.     elif "Insert" == command[0]:
  11.         idx = int(command[1])
  12.         value = command[2]
  13.         message = message[:idx] + value + message[idx:]
  14.     elif "ChangeAll" == command[0]:
  15.         substring = command[1]
  16.         replacement = command[2]
  17.         message = message.replace(substring, replacement)
  18.  
  19. print(f"The decrypted message is: {message}")
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement