fork download
  1. import java.io.*;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) throws IOException {
  6.  
  7. String[] arr = br.readLine().split(" ");
  8. if(arr[0].isBlank()) {
  9. System.out.println(arr.length-1);
  10. }
  11. else {
  12. System.out.println(arr.length);
  13. }
  14.  
  15. }
  16. }
Runtime error #stdin #stdout #stderr 0.08s 53040KB
stdin
 
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at Main.main(Main.java:9)