首页 > 代码库 > POJ 2503

POJ 2503

 MAP  水题


1
#include <map> 2 #include <cstdio> 3 #include <iostream> 4 #include <string.h> 5 #include <cstring> 6 #include <string> 7 using namespace std; 8 map<string,string> a; 9 int main(){10 char s1[12],s2[12],s[30];11 while(gets(s)){12 if(strlen(s)==0)break;13 sscanf(s,"%s%s",s1,s2);14 a[s2]=s1;15 }16 string s3,s4;17 while(cin>>s3){18 s4=a[s3];19 if(s4.length()==0)printf("eh\n");20 else cout<<s4<<endl;21 }22 return 0;23 }