题目:http://poj.org/problem?id=2503
代码:
#include<stdio.h>
#include<string.h>
#include<map>
#include<string>
#include<iostream>
using namespace std;
int main()
{
char str[32],str1[15],str2[15];
map<string,string>mp;
while(gets(str))
{
if(strlen(str)==0)
break;
sscanf(str,"%s %s",str1,str2);
mp[str2]=str1;
}
string sr,oupt;
while(cin>>sr)
{
oupt=mp[string(sr)];
if(oupt.length()==0)
printf("eh\n");
else
//printf("%s\n",oupt.c_str()); // ?????????
cout<<oupt<<endl;
}
}