
CD
By: a guest on
Apr 26th, 2012 | syntax:
None | size: 0.78 KB | hits: 21 | expires: Never
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <fstream>
using namespace std;
bool a[1000010];
int main ()
{
long long n,m,i,j,temp,count;
//freopen ("input.txt","r",stdin);
//freopen ("output.txt","w",stdout);
memset (a,false,sizeof(a));
while (scanf ("%lld%lld",&n,&m))
{
if (!n && !m)
break;
for (i=0;i<n;i++)
{
scanf ("%lld",&temp);
a[temp]=true;
}
count=0;
for (i=0;i<m;i++)
{
scanf("%lld",&temp);
if (a[temp]==true)
count++;
}
printf ("%lld\n",count);
}
return 0;
}