看义杰MLE,然后就写了个,transform。。省事很多了
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1500
#include <iostream>
#include <cctype>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
int n, m;
while(cin>>n && n)
{
cin>>m;
map<string, int> mp;
string name;
for(int i = 0; i < n; i++)//所有人名
{
cin>>name;
transform(name.begin(), name.end(), name.begin(), ::toupper);
mp[name] = 1;
}
for(int i = 0; i < m; i++)//来信名单
{
cin>>name;
transform(name.begin(), name.end(), name.begin(), ::toupper);
if(mp[name] == 1)//在所有人名里面的话就踢出他,然后总数减一
{
n--;
mp[name] = 0;
}
}
cout<<n<<endl;
}
}