-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
27 lines (22 loc) · 749 Bytes
/
Solution.java
File metadata and controls
27 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
class Solution {
private static final Scanner in = new Scanner(System.in);
private static Map<String, Integer> phoneBook = new HashMap<>();
public static void main(String[] argh) {
int n = in.nextInt();
in.nextLine();
for (int i = 0; i < n; i++) {
String name = in.nextLine();
int phone = in.nextInt();
in.nextLine();
phoneBook.put(name, phone);
}
while (in.hasNext()) {
String s = in.nextLine();
if (phoneBook.containsKey(s)) System.out.printf("%s=%d%n", s, phoneBook.get(s));
else System.out.println("Not found");
}
}
}