您的位置:首页 > 其它

hdu 1075 What Are You Talking About(map)

2015-08-24 19:42 465 查看
题意:单词翻译

思路:map

#include<iostream>
#include<stdio.h>
#include<string.h>
#include<map>
using namespace std;

map<string,string>mp;

int main(){
string s1,s2;
char c;
cin>>s1;
while(cin>>s1){
if(s1=="END")break;
cin>>s2;
mp[s2]=s1;
}
cin>>s1;
getchar();
while(1){
s1="";
while(1){
scanf("%c",&c);
if(c<'a'||c>'z')break;
s1+=c;
}
if(c=='E')break;
if(mp.find(s1)==mp.end())cout<<s1;
else cout<<mp[s1];
printf("%c",c);
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: