2017-02-12 00:31:12 -08:00
|
|
|
// Author: Rodney Shaghoulian
|
|
|
|
|
// Github: github.com/rshaghoulian
|
|
|
|
|
// HackerRank: hackerrank.com/rshaghoulian
|
|
|
|
|
|
2017-02-18 23:43:07 -06:00
|
|
|
import java.io.BufferedReader;
|
|
|
|
|
import java.io.InputStreamReader;
|
2017-03-24 00:02:30 -05:00
|
|
|
import java.io.IOException;
|
2017-02-10 20:06:36 -08:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
2017-02-18 23:43:07 -06:00
|
|
|
/* BufferedReader is used instead of Scanner since it's faster and
|
|
|
|
|
won't time out on HackerRank test cases when using Java8 */
|
2017-02-10 20:06:36 -08:00
|
|
|
class Solution {
|
2017-09-11 09:32:17 -07:00
|
|
|
public static void main(String[] args) throws IOException {
|
2017-03-24 00:02:30 -05:00
|
|
|
/* Save input as entries in a HashMap */
|
2017-02-18 23:43:07 -06:00
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
2017-03-24 00:02:30 -05:00
|
|
|
int n = Integer.parseInt(br.readLine());
|
2017-02-10 20:06:36 -08:00
|
|
|
HashMap<String, Integer> map = new HashMap<>();
|
2017-02-18 23:43:07 -06:00
|
|
|
while (n-- > 0) {
|
|
|
|
|
String name = br.readLine();
|
2017-03-24 00:02:30 -05:00
|
|
|
int phone = Integer.parseInt(br.readLine());
|
2017-02-10 20:06:36 -08:00
|
|
|
map.put(name, phone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read each query and check if its in our HashMap */
|
2017-02-18 23:43:07 -06:00
|
|
|
String s;
|
|
|
|
|
while((s = br.readLine()) != null) {
|
2017-02-10 20:06:36 -08:00
|
|
|
if (map.containsKey(s)) {
|
|
|
|
|
System.out.println(s + "=" + map.get(s));
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("Not found");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-18 23:43:07 -06:00
|
|
|
br.close();
|
2017-02-10 20:06:36 -08:00
|
|
|
}
|
|
|
|
|
}
|