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));
// create a hashmap
HashMap<String, Integer> map = new HashMap<>();
while (true)
{
String id = reader.readLine();
String name = reader.readLine();
// conditional to end entry
if (!id.isEmpty() || !name.isEmpty())
{
int idInt = Integer.parseInt(id);
map.put(name, idInt);
}
else
{
for (Map.Entry<String, Integer> pair : map.entrySet())
{
System.out.println(pair.getValue() + " " + pair.getKey());
}
System.out.println(id + " " + name);
break;
}
}
}
}
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));
// create a hashmap
HashMap<String, Integer> map = new HashMap<>();
while (true)
{
String id = reader.readLine();
String name = reader.readLine();
// conditional to end entry
if (!id.isEmpty() || !name.isEmpty())
{
int idInt = Integer.parseInt(id);
map.put(name, idInt);
}
else
{
for (Map.Entry<String, Integer> pair : map.entrySet())
{
System.out.println(pair.getValue() + " " + pair.getKey());
}
System.out.println(id + " " + name);
break;
}
}
}
}