-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day8.java
27 lines (26 loc) · 799 Bytes
/
Day8.java
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
//Complete this code or write your own from scratch
import java.util.*;
import java.io.*;
import java.util.HashMap ;
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 s = in.next();
if(PhoneBook.containsKey(s)){
System.out.println(s + "=" + PhoneBook.get(s)) ;
}
else{
System.out.println("Not found") ;
}
}
in.close();
}
}