Write a method called wordCount that accepts a String as its parameter and returns the number of words in the String. A word is a sequence of one or more nonspace characters
public static int wordCount(String s){ if (s == null) return 0; return s.trim().split("\\s+").length; }
Have fun with the function.