Друзья! что не так?
package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
Модернизация ПО
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//list of addresses
Map<String, String> addresses = new HashMap<String, String>();
int i =0;
while (true) {
String city = reader.readLine();
String family = reader.readLine();
if (family.isEmpty() || city.isEmpty()) break;
addresses.put(family, city);
}
//read home number
String city = reader.readLine();
//String familySecondName = addresses.get(city);
for (HashMap.Entry<String, String> x: addresses.entrySet())
if (x.getValue().equals(city)) {
System.out.println(x.getKey());
break;
}
}
}