Question
Java problem: You are given a phone book that consists of people's names and their phone number. After that you will be given some person's
Java problem:
You are given a phone book that consists of people's names and their phone number. After that you will be given some person's name as query. For each query, print the phone number of that person.
Input Format
The first line will have an integer n denoting the number of entries in the phone book. Each entry consists of two lines: a name and the corresponding phone number.
After these, there will be some queries. Each query will contain a person's name. Read the queries until end-of-file.
Constraints
A person's name consists of only lowercase and uppercase English letters and it may be in the format 'first-name last-name' or in the format 'first-name'. Each phone number has exactly 8 digits without any leading zeros.
1 n 100000 1 Query 100000
Output Format
For each case, print "Not found" if the person has no entry in the phone book. Otherwise, print the person's name and phone number. See sample output (test case) for the exact format. Note that we will consider lowercases equal to uppercases, that is, "JOHN NORMAN", "John Norman", or "john norman" will be the same person in our application.
Sample Input 0
5 Dennis Ritchie 87654321 Eric GAMESS 99912222 john barnes 11122222 Dennis Barnes 12299933 Jennifer 12345678 Dennis Harry Barnes Eric Gamess Jennifer JENNIFER jennifer eric gamess Marc Eric GAMESS Dennis Johnson john barnes JOHN barnes JoHn BaRnEs
Sample Output 0
Not found Not found Eric Gamess=99912222 Jennifer=12345678 JENNIFER=12345678 jennifer=12345678 eric gamess=99912222 Not found Eric GAMESS=99912222 Not found john barnes=11122222 JOHN barnes=11122222 JoHn BaRnEs=11122222
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started