提交时间:2024-01-25 10:00:05

运行 ID: 127714

#include<bits/stdc++.h> using namespace std; string s; string st; string stt; map<string,string> mp; bool b; int main() { while(getline(cin,s)) { if(s.size()==0) { continue; } b=0; for(int i=0;i<s.size();i++) { if(s[i]==' ') { st=""; b=1; } else if(b==1) { st+=s[i]; } } if(b==1) { stt=""; for(int i=0;i<s.size();i++) { if(s[i]!=' ') { stt+=s[i]; } else { break; } } mp[st]=stt; } else { if(mp.find(s)!=mp.end()) { cout<<mp[s]; } else { cout<<"eh"; } cout<<endl; } } return 0; }