Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- message = input()
- while True:
- line = input()
- if line == "Reveal":
- break
- line_split = line.split(":|:")
- command = line_split[0]
- if command == "InsertSpace":
- given_index = int(line_split[1])
- message = message[:given_index] + " " + message[given_index:]
- print(message)
- elif command == "Reverse":
- substring = line_split[1]
- if substring in message:
- x = message.replace(substring, "", 1)
- message = x + substring[::-1]
- print(message)
- else:
- print("error")
- else:
- substring = line_split[1]
- replacement = line_split[2]
- y = message.replace(substring, replacement)
- message = y
- print(message)
- print(f"You have a new text message: {message}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement