Output is correct however not passing verification
package com.codegym.task.task10.task1019;
import java.io.*;
import java.util.LinkedHashMap;
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));
LinkedHashMap<String, Integer> linkedHashMap = new LinkedHashMap<>();
int id ;
String name;
int flag = 0;
for(int i = 0; flag != 1 ; i++)
{
id = Integer.parseInt(reader.readLine());
name = reader.readLine();
if(name.isEmpty())
flag = 1;
if(flag == 1)
{
System.out.println("Id=" + id);
linkedHashMap.put(name, id);
}
else
{
System.out.println("Id=" + id + " Name=" + name);
linkedHashMap.put(name, id);
}
}
for(Map.Entry<String, Integer> pair : linkedHashMap.entrySet())
{
System.out.println(pair.getValue() + " " + pair.getKey());
}
}
}