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-printablecharacters.
Example:
Input: "Hello, my name is John"
Output: 5
不是简单的split就行的!!
package com.string;
/**
* Title:
*
* @Author
* @CreateTime 2019/6/19 10:09
*/
public class Leetcode_434_NumberofSegmentsinaString {
/**
* Runtime: 0 ms, faster than 100.00% of Java online submissions for Number of Segments in a String.
* Memory Usage: 34.1 MB, less than 99.72% of Java online submissions for Number of Se