83. Common Friends

Acceptance — 0 accepted 0 submissions

Easy
ArraysHashingSorting
No companies listed
Rahul and Neha each have a list of friend IDs (some IDs may be repeated by mistake). Find the friends they have in common.

Print the common IDs in increasing order, each only once. If there are none, print None.

Input Format
The first line has n and m.
The second line has n IDs (Rahul).
The third line has m IDs (Neha).

Output Format
Print the common IDs in increasing order separated by spaces, or None.

Constraints
• 1 ≤ n, m ≤ 1000
• 1 ≤ ID ≤ 10^6

Example 1

Input
5 4
4 9 5 4 1
9 4 9 8
Output
4 9

Explanation 4 and 9 are in both lists.

Example 2

Input
3 3
1 2 3
4 5 6
Output
None

Explanation Nothing in common.

Example 3

Input
2 3
7 7
7 7 7
Output
7

Explanation 7 is common, and is printed once.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
4 9
No results yet
Run your code to test it against the sample cases.
Problem List