Guest User

Untitled

a guest
Jan 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. static Scanner s=new Scanner(System.in);
  2. static String words[];
  3. static String str;
  4.  
  5. void perform(int i)
  6. {
  7. i++;
  8.  
  9. if(i<(words.length-1))
  10. {
  11. perform(i);
  12. }
  13.  
  14. System.out.print(words[i]+",");
  15. }
  16.  
  17.  
  18. public static void main(String[] args)
  19. {
  20. Test t=new Test();
  21. str=s.next();
  22. words=str.split("\s+");
  23. System.out.println("Length of words is-"+words.length);
  24. //Output is always 1
  25. t.perform(-1);
  26.  
  27. }
Add Comment
Please, Sign In to add comment