Crazy

Преведувач

Nov 25th, 2017
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.util.Hashtable;
  2. import java.util.Scanner;
  3.  
  4. public class Preveduvac {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner in = new Scanner(System.in);
  9.         Hashtable<String, String> table = new Hashtable<>();
  10.  
  11.         int n = Integer.parseInt(in.nextLine());
  12.  
  13.         for (int i=0;i<n;i++)
  14.         {
  15.             String input = in.nextLine();
  16.  
  17.             String [] razdelen = input.split(" ");
  18.  
  19.             table.put(razdelen[1], razdelen[0]);
  20.         }
  21.  
  22.         //System.out.println(table);
  23.  
  24.         String next = in.nextLine();
  25.  
  26.         while (!next.equals("KRAJ"))
  27.         {
  28.  
  29.             if (table.containsKey(next))
  30.                 System.out.println(table.get(next));
  31.             else
  32.                 System.out.println("/");
  33.  
  34.  
  35.             next= in.nextLine();
  36.  
  37.         }
  38.  
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment