Problem Description

Read q operations: SET k v, RENAME old new. RENAME works only if old exists and new does not exist. At end output number of keys and then keys sorted.

Input Format

First line q. Next q lines operations.

Output Format

First line count, next lines keys.

Sample Test Case

Input:
5 SET a 1 SET b 2 RENAME a c RENAME b c RENAME b d
Output:
2 c d

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next