0434. Number of Segments in a String
https://leetcode.com/problems/number-of-segments-in-a-string
Description
You are given a string s
, return the number of segments in the string.
A segment is defined to be a contiguous sequence of non-space characters.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
0 <= s.length <= 300
s
consists of lower-case and upper-case English letters, digits or one of the following characters"!@#$%^&*()_+-=',.:"
.The only space character in
s
is' '
.
ac
Last updated