package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Модернизация ПО
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Map<String, String> map = new HashMap<String, String>();
while (true){
String city = reader.readLine();
String family = reader.readLine();
if (city.isEmpty()||family.isEmpty()){
break;
}
map.put(city, family);
}
String cityS = reader.readLine();
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext())
{
Map.Entry<String, String> pair = iterator.next();
String key = pair.getKey();
String value = pair.getValue();
if (key.equals(cityS)){
System.out.println(value);
}
}
}
}package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Модернизация ПО
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//List<String> list = new ArrayList<>();
Map<String, String> map = new HashMap<String, String>();
/*while (true) {
String family = reader.readLine();
if (family.isEmpty()) {
break;
}
//list.add(family);
}*/
while (true){
String city = reader.readLine();
String family = reader.readLine();
if (city.isEmpty()||family.isEmpty()){
break;
}
map.put(city, family);
}
// Read the house number
//int houseNumber = Integer.parseInt(reader.readLine());
String cityS = reader.readLine();
/*if (0 <= houseNumber && houseNumber < list.size()) {
String familyName = list.get(houseNumber);
System.out.println(familyName);
}*/
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext())
{
//получение «пары» элементов
Map.Entry<String, String> pair = iterator.next();
String key = pair.getKey();
String value = pair.getValue();
if (key.equals(cityS)){
System.out.println(value);
}
}
}
}