first_line = input()

new_line = ""
while True:
    line = input()
    if line == "Done":
        break

    line_split = line.split()
    command = line_split[0]

    if command == "TakeOdd":
        for ch in range(1, len(first_line), 2):
            new_line += first_line[ch]
        first_line = new_line
        print(first_line)

    elif command == "Cut":
        given_index = int(line_split[1])
        given_length = int(line_split[2])
        first_part = (first_line[:given_index])
        second_part = (first_line[given_index + given_length:])
        first_line = first_part + second_part
        print(first_line)
    else:
        substring = line_split[1]
        substitute = line_split[2]
        if substring in first_line:
            x = first_line.replace(substring, substitute)
            first_line = x
            print(first_line)
        else:
            print(f"Nothing to replace!")

print(f"Your password is: {first_line}")
