Given a list of countries and cities of each country, then given the names of the cities.
Fantastic news! We've Found the answer you've been seeking!
Question:
Given a list of countries and cities of each country, then given the names of the cities. For each city print the country in which it is located.
- Take an integer n as input representing the number of countries for which you will enter cities
- Next take input of a country and cities in the country seperated by spaces. Do this n times.
- Take input of an integer m for number of cities to take.
- Take input of a city m times
- Output the country for which each city in step 4 belongs.
Example input:
2 USA Boston Pittsburgh Washington Seattle UK London Edinburgh Cardiff Belfast 3 Cardiff Seattle London
Example output:
UK USA UK
Has to be done in java and has to use HashMaps
Related Book For
Introduction to Operations Research
ISBN: 978-1259162985
10th edition
Authors: Frederick S. Hillier, Gerald J. Lieberman
Posted Date: