fork(3) 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. String tratar = "10\n"
  13. + "20 30\n"
  14. + "40 50 60\n"
  15. + "\n"
  16. + "70 80 90\n"
  17. + "\n"
  18. + "\n"
  19. + "100";
  20.  
  21. String nova = tratar.replace(" ", "\n").replaceAll("\n+", "\n");
  22.  
  23. System.out.println(nova);
  24. }
  25. }
Success #stdin #stdout 0.05s 27744KB
stdin
Standard input is empty
stdout
10
20
30
40
50
60
70
80
90
100