这道题目给我印象最深的就是这道题目的输入了。。。
#include<stdio.h>
#include<map>
#include<string>
#include<iostream>
using namespace std;
char a[11],b[11],charge[11];
int main(){
map<string,string> judge;
map<string,int> yes;
int num;
char ch;
//memset(yes,0,sizeof(yes));
for(;;){
if((ch=getchar())=='\n') break;
else{
a[0]=ch;
num=1;
for(;;){
ch=getchar();
if(ch==' '){
a[num]='\0';
break;
}
else{
a[num]=ch;
num++;
}
}
scanf("%s",b);
getchar();//这个很重要 这就是为什么输入的时候用两个换行才可以进入翻译阶段这里要吃掉一个换行
yes[b]=1;
judge[b]=a;
}
}
while(scanf("%s",charge)!=EOF){
if(!yes[charge]){
printf("eh\n");
}
else{
cout<<judge[charge]<<endl;
}
}
return 0;
}