用字典树没过,学习了一下map;
参考博客:http://blog.csdn.net/zhengnanlee/article/details/8962432
AC代码
1 #include<iostream> 2 #include<map> 3 #include<algorithm> 4 5 using namespace std; 6 int main() 7 { 8 int n,m,i; 9 while(cin>>n&&n) 10 { 11 cin>>m; 12 map<string,int>mp; 13 string name; 14 for(i=0; i<n; i++) 15 { 16 cin>>name; 17 transform(name.begin(),name.end(),name.begin(),::toupper); 18 mp[name]=1; 19 } 20 while(m--) 21 { 22 cin>>name; 23 transform(name.begin(),name.end(),name.begin(),::toupper); 24 if(mp[name]) 25 { 26 n--; 27 mp[name]=0; 28 } 29 } 30 cout<<n<<endl; 31 } 32 }