MCPcopy
hub / github.com/HuberTRoy/leetCode / countSegments

Method countSegments

String/NumberOfSegmentsInString.py:27–38  ·  view source on GitHub ↗

:type s: str :rtype: int

(self, s)

Source from the content-addressed store, hash-verified

25
26class Solution(object):
27 def countSegments(self, s):
28 """
29 :type s: str
30 :rtype: int
31 """
32 s = s.strip()
33 if not s.strip():
34 return 0
35
36 result = re.split(r'\s+', s)
37
38 return len(result)

Callers

nothing calls this directly

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected