Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text = list(input())
- while True:
- command = input()
- if "Decode" in command:
- break
- instructions = command.split("|")
- if "Move" in instructions:
- n = int(instructions[1])
- text1 = text[:n]
- text2 = text[n:]
- text = text2 + text1
- elif "Insert" in instructions:
- index = int(instructions[1])
- value = instructions[2]
- text.insert(index, value)
- text = list("".join(text))
- elif "ChangeAll" in instructions:
- substring = instructions[1]
- replacement = instructions[2]
- text = [replacement if s == substring else s for s in text]
- print(f"The decrypted message is: {''.join(text)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement