fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner scan = new Scanner(System.in);
  13.  
  14. List<int[]> temp = new ArrayList<>();
  15. while (true) {
  16. if (!scan.hasNextInt()) break;
  17. int first = scan.nextInt();
  18. if (!scan.hasNextInt()) break;
  19. int second = scan.nextInt();
  20. temp.add(new int[] { first, second });
  21. }
  22. scan.close();
  23. System.out.println(temp.size());
  24. for (int[] a : temp) {
  25. System.out.println(a[0]+" "+a[1]);
  26. }
  27. }
  28. }
Success #stdin #stdout 0.14s 321088KB
stdin
4 6
2 3
4 8
9 5
stdout
4
4 6
2 3
4 8
9 5