Array Intersection · Compiler

Array Intersection

Two birdwatchers record integer species codes. Count the distinct codes that appear in both logs.

Input
Line 1 contains the lengths n and m (0 to 100 each). The remaining whitespace-separated integers are the n values of the first array followed by the m values of the second. Each value is from -1000 to 1000.
Output
Print the number of shared codes, counting each code once.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…