Здравствуйте. Почему не принимает? В компиляторе работает, а в javarush нет.
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<>();
while (true) {
String city = reader.readLine();
String family = reader.readLine();
if (family.isEmpty()||city.isEmpty())
break;
map.put(family, city);
}
// Read the house number
String thisCity = reader.readLine();
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> pair = iterator.next();
String city1 = pair.getValue();
if (city1.equals(thisCity))
System.out.println(pair.getKey());
}
}
}