首页 > 代码库 > poj2503

poj2503

#include <iostream>
#include <string>
#include <map>
using namespace std;
char s[100],s1[100],s2[100];
map <string,string> my;
map <string,string> ::iterator it;

int main(int argc, char *argv[])

int i;
 while (gets(s))
 {

 if (strcmp(s,"")==0) break;
  sscanf(s,"%s%s",s1,s2);
  my[s2]=s1;
 }
 while (scanf("%s",s)!=EOF)
 { 

it=my.find(s);
  if ( it!=my.end()) cout<<my[s]<<endl; 

      else               cout<<"eh\n";
 }      
 return 0;
}