From f1200c06cedf3f5cb581ee5fb87af3a17b068a98 Mon Sep 17 00:00:00 2001 From: Prasoon Date: Wed, 31 Jan 2018 16:00:04 +0530 Subject: [PATCH] Fix a logical error --- Others/countwords.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Others/countwords.java b/Others/countwords.java index a72ef9c9c..a93aa1a33 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; }