Don’t know what to do again
package com.codegym.task.task10.task1019;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/*
Functionality is not enough!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String, Integer> map = new HashMap<>();
while (true) {
try{
int id = Integer.parseInt(reader.readLine());
String name = reader.readLine();
if(name.isEmpty()){
//map.put(null,id);
break;
}
if(map.containsKey(name))
map.put("", id);
else map.put(name, id);
}
catch (NumberFormatException e){
break;
}
}
for(Map.Entry<String, Integer> pair : map.entrySet())
System.out.println(pair.getValue() + " " + pair.getKey());
}
}