Problem Description

Commands: ADD text, DEL k, UNDO. Print final text.

Input Format

First line q. Next q lines.

Output Format

One line final text.

Sample Test Case

Input:
6 ADD ab ADD cd DEL 1 UNDO ADD e UNDO
Output:
abcd

Constraints

q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next