Skip to content

Instantly share code, notes, and snippets.

@jaideepjagyasi
Created March 23, 2018 05:14
Show Gist options
  • Save jaideepjagyasi/99d49b3d704295bdfafd82bab93fcac2 to your computer and use it in GitHub Desktop.
Save jaideepjagyasi/99d49b3d704295bdfafd82bab93fcac2 to your computer and use it in GitHub Desktop.
//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