-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay 8
27 lines (22 loc) · 744 Bytes
/
Day 8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.HashMap;
import java.util.Scanner;
class Solution {
public static void main(String[] argh) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
HashMap<String, Integer> phoneBook = new HashMap<String, Integer>();
for (int i = 0; i < n; i++) {
String name = in.next();
int phone = in.nextInt();
phoneBook.put(name, phone);
}
while (in.hasNext()) {
String name = in.next();
if (phoneBook.containsKey(name)) {
int phone = phoneBook.get(name);
System.out.println(name + "=" + phone);
} else System.out.println("Not found");
}
in.close();
}
}