Created
March 23, 2018 05:14
-
-
Save jaideepjagyasi/99d49b3d704295bdfafd82bab93fcac2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(); | |
map.put(name,phone); | |
// Write code here | |
} | |
while(in.hasNext()){ | |
String s = in.next(); | |
// Write code here | |
if(map.get(s)!=null){ | |
System.out.println(s+"="+map.get(s)); | |
} | |
else{ | |
System.out.println("Not found"); | |
} | |
} | |
in.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment