434. Number of Segments in a String

Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.

计算字符串中的段数,其中段定义为非空格字符的连续序列。

Please note that the string does not contain any non-printable characters.

请注意,该字符串不包含任何不可打印的字符。

Example:

Input: "Hello, my name is John"
Output: 5

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦