-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathDay8:DictionariesandMaps.java
More file actions
26 lines (25 loc) · 767 Bytes
/
Copy pathDay8:DictionariesandMaps.java
File metadata and controls
26 lines (25 loc) · 767 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
26
//Complete this code or write your own from scratch
import java.util.*;
import java.io.*;
class Solution{
public static void main(String []argh){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
HashMap<String,Integer> map = new HashMap<String,Integer>();
for(int i = 0; i < n; i++){
String name = in.next();
int phone = in.nextInt();
// Write code here
map.put(name,phone);
}
while(in.hasNext()){
String s = in.next();
// Write code here
if(map.containsKey(s))
System.out.println(s+"="+map.get(s));
else
System.out.println("Not found");
}
in.close();
}
}