词典 (noi OpenJudge)

 

  传送门:1806:词典

  神奇的STL

 

 

 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <map> 
#include <sstream>
using namespace std;
string s, s1, s2, word;
map <string, string> dic;
int main()
{
    while (getline (cin, s) && s != "")
    {
        stringstream sin (s);
        sin >> s1 >> s2;
        dic [s2] = s1;
    }
    while (cin >> word)
    {
        if (dic [word] == "")
            cout << "eh" << endl;
        else 
            cout << dic [word] << endl;
    }
    return 0;
}

 

posted @ 2016-12-10 21:19  ZlycerQan  阅读(681)  评论(0编辑  收藏  举报