I keep failing the last condition
"The program should display the family's last name based on the entered city"
even though running the program works.what am i doing wrong?
package com.codegym.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
//import java.util.List;
/*
Software update
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// List of addresses
HashMap<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 city name
String city = reader.readLine();
String familyName = map.get(city);
System.out.println(familyName);
}
}