Помогите пожалуйста найти ошибку в моём коде к этой задаче.
Основная проблема в том, что вывод полностью соответствует условию (код рабочий):
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));
//System.out.println("Please, enter family");
//List<String> list = new ArrayList<>();
Map<String, String> map = new HashMap<String, String>();
while (true) {
String family = reader.readLine();
if (family.isEmpty()) {
break;
}
String city = reader.readLine();
map.put(city, family);
}
// Read the house number
//System.out.println("Please, enter city");
String enterCity = reader.readLine();
if (map.containsKey(enterCity)) {
String familyName = map.get(enterCity);
//System.out.println("Check");
System.out.println(familyName);
}
}
}