Skip to content
C

Find the Intersection of Two Arrays

Easyjavapythonccppjavascript

Given two arrays, find the values that are present in both arrays. Each value must appear only once in the result.

Input Format

The first line contains an integer N. The second line contains N space-separated integers (array A). The third line contains an integer M. The fourth line contains M space-separated integers (array B).

Output Format

Print the distinct common values in increasing order, separated by single spaces. If there are no common values, print an empty line.

Input (stdin)

Output

Run your code to see output here...