mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 02:04:31 +08:00
Fix a logical error
This commit is contained in:
@ -19,7 +19,7 @@ import java.util.Scanner;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int wordCount(String s){
|
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;
|
return s.trim().split("[\\s]+").length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user