Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stops = input()
- command_data = input().split(":")
- while True:
- command = command_data[0]
- if command == "Travel":
- break
- if command == "Add Stop":
- index = int(command_data[1])
- add_string = command_data[2]
- if 0 <= index < len(stops):
- stops = stops[:index] + add_string + stops[index:]
- print(stops)
- elif command == "Remove Stop":
- start_index = int(command_data[1])
- end_index = int(command_data[2])
- if 0 <= start_index < len(stops) and 0 <= end_index < len(stops):
- stops = stops[:start_index] + stops[end_index + 1:]
- print(stops)
- elif command == "Switch":
- old_string = command_data[1]
- new_string = command_data[2]
- stops = stops.replace(old_string, new_string)
- print(stops)
- command_data = input().split(":")
- print(f"Ready for world tour! Planned stops: {stops}")
Advertisement
Add Comment
Please, Sign In to add comment