poj2503(stl, map ,sscanf)

来源:互联网 发布:mac 重装 编辑:程序博客网 时间:2024/06/05 21:15
#include <iostream>#include <cstring>#include <algorithm>#include <cstdio>#include <map>using namespace std;int main(){    char c1[30], c2[30], c3[30];    string ss;    map<string, string>s;    while(gets(c1)){        if(strlen(c1) == 0) break;        sscanf(c1, "%s %s", c2, c3);        s[string(c3)] = c2;    }    while(cin >> ss){        string r = s[ss];        if(!r.length()) cout << "eh" << endl;        else            cout << r << endl;    }    return 0;}

0 0