fork download
  1. import java.io.PrintStream;
  2. import java.util.*;
  3.  
  4. public class Main
  5. {
  6.  
  7. static PrintStream o=System.out;
  8. public static void main (String[] args)
  9. throws Exception
  10. {
  11. String s="a, b, c, d,,,";
  12.  
  13. String[] spl=s.split ( "," );
  14. o.println(spl.length);
  15. for (String s1: spl)
  16. o.print(s1+";");
  17.  
  18. o.println("\n"+st.countTokens ());
  19. while (st.hasMoreElements ()){
  20. o.print(
  21. st.nextToken ()+";"
  22. );
  23. }
  24. st=new StringTokenizer(s,",");
  25. o.println("\n"+st.countTokens ());
  26. while (st.hasMoreElements ()){
  27. o.print(
  28. st.nextToken ()+";"
  29. );
  30. }
  31. }
  32. }
  33.  
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
4
a; b; c; d;
4
a,;b,;c,;d,,,;
4
a; b; c; d;