Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define LL unsigned long long
- using namespace std;
- int main() {
- int n,m,cont,aux;
- while(scanf("%d %d",&n,&m)){
- if(n==0 && m==0) break;cont=0;
- map<int,bool> mp;
- for(int i=0;i<n;i++){
- scanf("%d",&aux);
- mp[aux]=true;
- }
- for(int i=0;i<m;i++){
- scanf("%d",&aux);
- if(mp.count(aux)==0){
- continue;
- }else cont++;
- }
- printf("%d\n",cont);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement