Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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) {
- String r = reader.readLine();
- if (r.isEmpty()) break;
- Integer n = Integer.parseInt(r);
- if (n == null) break;
- String i = reader.readLine();
- map.put(i, n);
- if (i.isEmpty()) {
- break;
- }
- }
- for (Map.Entry<String, Integer> pair : map.entrySet()) {
- System.out.println(pair.getValue() + " " + pair.getKey());
- }
- }
- }
Add Comment
Please, Sign In to add comment