':type s: str
:rtype: int'

def countSegments(self, s):

    result = int((len(s) and (s[(-1)] != '    ')))
    for i in xrange(1, len(s)):
        if ((s[i] == '    ') and (s[(i - 1)] != '    ')):
            result += 1
    return result
