diff --git a/Others/countwords.java b/Others/countwords.java index a72ef9c9..a93aa1a3 100644 --- a/Others/countwords.java +++ b/Others/countwords.java @@ -19,7 +19,7 @@ import java.util.Scanner; } private static int wordCount(String s){ - if(s.isEmpty() || s == null) return -1; + if(s.isEmpty() || s == null) return 0; return s.trim().split("[\\s]+").length; }