fork(1) 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 func(String str,String s){
  11. String Str = s+str+s;
  12. String[]array = new String[100];
  13. int[]ray = new int[100];
  14. for(int i = 1 ; i<=Str.length();i++ ){
  15. array[i-1] = Str.substring(i-1, i);
  16. }
  17. int j=0;
  18. for(int i = 0 ; i <=Str.length()-1;i++){
  19. if (array[i].equals(s)){
  20. ray[j] = i;
  21. j++;
  22. }
  23. }
  24. ray[j]=Str.length();
  25. for(int i =0;i<j-1;i++){
  26. System.out.print(Str.substring(ray[i]+1, ray[i+1])+"\t");
  27. }
  28. }
  29.  
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. // your code goes here
  33. String str = "jlkjdsf fjkaf aaaa";
  34. String s = " ";
  35. func(str,s);
  36. }
  37. }
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
jlkjdsf	fjkaf	aaaa