Guest User

Untitled

a guest
Jun 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public class Solution {
  2. public static void main(String[] args) throws IOException {
  3. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  4. HashMap<String, Integer> map = new HashMap<>();
  5. while (true) {
  6. String r = reader.readLine();
  7. if (r.isEmpty()) break;
  8. Integer n = Integer.parseInt(r);
  9. if (n == null) break;
  10. String i = reader.readLine();
  11. map.put(i, n);
  12. if (i.isEmpty()) {
  13. break;
  14. }
  15. }
  16. for (Map.Entry<String, Integer> pair : map.entrySet()) {
  17. System.out.println(pair.getValue() + " " + pair.getKey());
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment