Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.util.HashMap;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static Scanner in = new Scanner(System.in);
  7. public static HashMap<String, String> dict = new HashMap<String, String>();
  8.  
  9. public static void main(String[] args) {
  10.  
  11. String line = in.nextLine();
  12.  
  13. while(!line.equals(""))
  14. {
  15. String[] words = line.split(" ");
  16. dict.put(words[1], words[0]);
  17. line = in.nextLine();
  18.  
  19. }
  20.  
  21. while(in.hasNextLine())
  22. {
  23. line = in.nextLine();
  24. if(dict.containsKey(line))
  25. System.out.println(dict.get(line));
  26. else
  27. System.out.println("eh");
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement