fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. map<string,string> m;
  4. int n,i=1;
  5. string c,arr;
  6. int main(){
  7. while(getline(cin,arr)){
  8. if(arr.empty()){
  9. break;
  10. }
  11. string a=arr.substr(0,arr.find(' '));
  12. string b=arr.substr(arr.find(' ')+1);
  13. m[b]=a;
  14. }
  15. while(cin>>c){
  16. if(c.empty()) break;
  17. if(m.find(c)!=m.end()){
  18. cout<<m[c]<<"\n";
  19. }else{
  20. cout<<"eh\n";
  21. }
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5320KB
stdin
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay

atcay
ittenkay
oopslay
stdout
cat
eh
loops