class Solution(object): def countSegments(self, s): """ :type s: str :rtype: int """ return len(s.split())