P8833 [Chuanzhi Cup #3 Finals] Courses
Background
disangan233 likes counting, so he wants you to help him answer a question.
Description
Chuanzhi Professional Academy offers two courses $A, B$, with $n, m$ students enrolled respectively. The IDs of students enrolled in $A$ are $a_n$, and the IDs of students enrolled in $B$ are $b_m$. Find how many students enrolled in both courses.
For all testdata, $n, m, a_i, b_i \leq 20$. It is guaranteed that the student IDs enrolled in each course will not repeat.
Input Format
The input has $3$ lines.
The first line contains two positive integers $n, m$.
The second line contains $n$ positive integers $a_1 \ldots a_n$, representing the student IDs enrolled in course $A$.
The third line contains $m$ positive integers $b_1 \ldots b_m$, representing the student IDs enrolled in course $B$.
**The student IDs are not guaranteed to be sorted in increasing order.**
Output Format
Output one line containing one integer, which is the answer.
Explanation/Hint
# Sample Explanation
We find that these $4$ students with IDs $1, 3, 4, 5$ enrolled in both courses, so the answer is $4$.
Translated by ChatGPT 5