fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,t;
  8. cin>>n>>t;
  9. string nama[n],telpon[n],target[t];
  10. for(int i=0;i<n;i++)
  11. {
  12. cin>>nama[i]>>telpon[n];
  13. }
  14. for(int i=0;i<t;i++)
  15. {
  16. cin>>target[i];
  17. for(int j=0;j<n;j++)
  18. {
  19. if(target[i]==nama[j])
  20. {
  21. cout<<telpon[n]<<endl;
  22. break;
  23. }
  24. else if(j==n-1)cout<<"NIHIL"<<endl;
  25. }
  26. }
  27. }
Success #stdin #stdout 0s 4312KB
stdin
7 2
agung 572381
ani 111111
budi 222222
dengklek 696969
ganesh 987123
gareng 429088
hadi 682385
budi
nyancoder
stdout
682385
NIHIL