Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- message = input()
- while True:
- line = input()
- if line == "Decode":
- break
- line_split = line.split("|")
- command = line_split[0]
- if command == "Move":
- number_of_letters = int(line_split[1])
- part_replace = message[:number_of_letters]
- message = message.replace(part_replace, "") + part_replace
- elif command == "Insert":
- given_index = int(line_split[1])
- given_value = line_split[2]
- message = message[:given_index] + given_value + message[given_index:]
- else:
- substring = line_split[1]
- replacement = line_split[2]
- message = message.replace(substring, replacement)
- print(f"The decrypted message is: {message}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement