Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 23 Accepted Submission(s) : 12
Font: Times New Roman | Verdana | Georgia
Font Size: ←→
Problem Description
Input
首先给出N和M,用空格分开。
然后给出一行英文其中包含N个单词,每个单词由小写字母组成且长度小于20,单词之间用空格分开。
接下来M行分别是xianbin5会的单词(每个单词由小写字母组成且长度小于20,而且每个单词各不相同)。
Output
Sample Input
5 4 i love math and acm i love and math 8 1 can you find grandparents can you answers me me
Sample Output
1 5
Author
Source
#include <iostream>
#include <stdio.h>
#include<string>
#include <string.h>
#include <algorithm>
#define N 10001
#include <set>
using namespace std;
int main()
{
int n,m;
string str;
int nt;
while(cin>>n>>m)
{ set<string> S;
nt=0;
while(n--)
{
cin>>str;
S.insert(str);
}
while(m--)
{
cin>>str;
if(S.find(str)!=S.end())
nt++;
}
cout<<S.size()-nt<<endl;
}
}