Count Words
Counts the number of words in a string
- string
- word
- count
- word-count
Code
def count_words(s):
return len(s.split())Usage
System.out.println(countWords("hello world")); // 2Counts the number of words in a string
def count_words(s):
return len(s.split())System.out.println(countWords("hello world")); // 2