-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay-8.java
More file actions
25 lines (24 loc) · 730 Bytes
/
Day-8.java
File metadata and controls
25 lines (24 loc) · 730 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
25
import java.util.*;
import java.io.*;
class Solution{
public static void main(String []args){
Map<String,Integer> phoneBook = new HashMap<String,Integer>();
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for(int i = 0; i < n; i++){
String name = scan.next();
int phone = scan.nextInt();
phoneBook.put(name, phone);
}
while(scan.hasNext()){
String s = scan.next();
Integer phoneNumber = phoneBook.get(s);
System.out.println(
(phoneNumber != null)
? s + "=" + phoneNumber
: "Not found"
);
}
scan.close();
}
}