提交时间:2024-01-25 09:39:12
运行 ID: 127607
#include <bits/stdc++.h> using namespace std; int main() { map <string,string> lst; int idx = 1; string str; while(true) { getline(cin,str); if(str==""){ break; } string s1,s2; int M = 0; for(int i = 0;i < str.size();i++) { if(str[i] == ' ') { M = i; break; } } for(int i = 0;i < M;i++) s1 += str[i]; for(int i = M + 1;i < str.size();i++) s2 += str[i]; lst[s2] = s1; } string s; while(cin>>s) { if(lst[s] == "") cout << "eh" << endl; else cout << lst[s] << endl; } }