Swap Values of Two Keys

Programming Interview Easy 5 views
Back to Questions

Problem Description

You're given {x}. Then two keys k1 and k2 are provided. If both keys exist, swap their values. Finally output value of k1 and value of k2 (use NA if a key does not exist).

Input Format

First line n. Next n lines: key value. Last line: k1 k2.

Output Format

One line: val1 val2.

Sample Test Case

Input:
4 a red b blue c green d black a c
Output:
green red

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev