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. // your code goes here
  13. String command = ReadString();
  14. String words[]=new String[4];
  15. String[] n = command.split(" ");
  16.  
  17. for(int i=0; i< 4; i++)
  18. {
  19. if((n.length-1)==i)
  20. {
  21. words[i]=n[i];
  22. }
  23. else
  24. {
  25. words[i]="empty";
  26. }
  27. }
  28. System.out.println(words[1]);
  29. }
  30.  
  31. static String ReadString() {
  32. Scanner scan = new Scanner(System.in);
  33. return scan.nextLine();
  34. }
  35. }
Success #stdin #stdout 0.06s 4386816KB
stdin
12kldjh
stdout
empty