Guest User

Untitled

a guest
Aug 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3.  
  4. class Solution{
  5. public static void main(String []argh){
  6. Scanner in = new Scanner(System.in);
  7. int n = in.nextInt();
  8. HashMap<String,Integer> phoneBook = new HashMap<String,Integer>();
  9. for(int i = 0; i < n; i++){
  10. String name = in.next();
  11. int phone = in.nextInt();
  12. // Write code here
  13. phoneBook.put(name,phone);
  14. }
  15. while(in.hasNext()){
  16. String s = in.next();
  17. // Write code here
  18. if( phoneBook.keySet().contains(s)){
  19. System.out.println(s+"="+phoneBook.get(s));
  20. }else{
  21. System.out.println("Not found");
  22. }
  23. }
  24. in.close();
  25. }
  26. }
Add Comment
Please, Sign In to add comment