传送门: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; }