#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll n, m, i, a, b;
while(cin >> n >> m && n != 0 && m != 0)
{
map<ll, ll>mp;
int c = 0;
for(i=1;i<=n;i++)
{
cin >> a;
mp[a]++;
}
for(i=1;i<=m;i++)
{
cin >> b;
if(mp[b] == 1)
c++;
}
cout << c << "\n";
}
return 0;
}
#define ll long long int
using namespace std;
int main()
{
ll n, m, i, a, b;
while(cin >> n >> m && n != 0 && m != 0)
{
map<ll, ll>mp;
int c = 0;
for(i=1;i<=n;i++)
{
cin >> a;
mp[a]++;
}
for(i=1;i<=m;i++)
{
cin >> b;
if(mp[b] == 1)
c++;
}
cout << c << "\n";
}
return 0;
}
Comments
Post a Comment