CCCPaste

world tour

first_line = input()

while True:
    line = input()
    if line == "Travel":
        break

    line_split = line.split(":")
    command = line_split[0]

    if command == "Add Stop":
        given_index = int(line_split[1])
        new_stop = line_split[2]
        if 0 <= given_index <= len(first_line):
            first_line = (first_line[:given_index] + new_stop + first_line[given_index:])
            print(first_line)

    elif command == "Remove Stop":
        start_idx = int(line_split[1])
        end_idx = int(line_split[2])
        if 0 <= start_idx <= len(first_line) and 0 <= end_idx <= len(first_line):
            first_line = (first_line[:start_idx]) + first_line[end_idx + 1:]
            print(first_line)
    else:
        old_stop = line_split[1]
        new_stop = line_split[2]
        first_line = first_line.replace(old_stop, new_stop)
        print(first_line)

print(f"Ready for world tour! Planned stops: {first_line}")