阅读背景:

如何计算一个字之间有空格的字符串中的确切单词数?

来源:互联网 

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 (any character other than ' '). For example, the call wordCount("hello") should return 1, the call wordCount("how are you?") should return 3, the call wordCount(" this string has wide spaces ") should return 5, and the call wordCount(" ") should return 0. Write a method called wordCount that accepts a




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: