题目 :Problem - 1075 (hdu.edu.cn)
#include<bits/stdc++.h>
using namespace std;
map <string , string > mymap;
int main(){
string earth,s;
cin>>earth;
while(cin>>earth&&earth!="END"){
string mar;
cin>>mar;
mymap[mar]=earth;
}
cin>>s;
getline(cin,s);
while(getline(cin,s)&&s!="END"){
string p="";
for(int i=0;i<s.size();i++){
if(s[i]>='a'&&s[i]<='z'){
p+=s[i];
if((s[i+1]>='a'&&s[i+1]<='z')==0){
if(mymap[p]==""){
cout<<p;
}
else{
cout<<mymap[p];
}
p="";
}
}
else{
cout<<s[i];
}
}
cout<<endl;
}
return 0;
}