fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n; cin >> n;
  6. cin.ignore();
  7. map<string, string> mp;
  8. for(int i = 0; i < n; i++){
  9. string msv, name;
  10. getline(cin, msv);
  11. getline(cin, name);
  12. mp[msv] = name;
  13. }
  14. int q; cin >> q;
  15. while(q--){
  16. string msv; cin >> msv;
  17. if(mp.find(msv) != mp.end()){
  18. cout << mp[msv] << endl;
  19. }
  20. else cout << "NOT FOUND" << endl;
  21. }
  22. }
Success #stdin #stdout 0s 5312KB
stdin
3
SV001
Hoang Van Nam
SV002
Ngo Gia Long
SV005
Phuong The Ngoc
2
SV005
SV003
stdout
Phuong The Ngoc
NOT FOUND