Skip to content

Commit 4e6a859

Browse files
authored
Merge pull request TheAlgorithms#374 from GammaBurst101/Fix-error
Fix a logical error and set a method to private
2 parents 81d3e9b + f1200c0 commit 4e6a859

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Others/countwords.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public static void main(String[] args){
1818
input.close();
1919
}
2020

21-
public static int wordCount(String s){
22-
if(s.isEmpty() || s == null) return -1;
21+
private static int wordCount(String s){
22+
if(s.isEmpty() || s == null) return 0;
2323
return s.trim().split("[\\s]+").length;
2424
}
2525

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy