<doocs>0434.Number of Segments in a String_1.py
def countSegments( s: str) -> int:
    res = 0
    for i in range(len(s)):
        if s[i] != ' ' and (i == 0 or s[i - 1] == ' '):
            res += 1
    return res
def sample_funcname ( var_0 : str ) -> int :
    var_4 = 0
    for var_7 in range ( len ( var_0 ) ) :
        if var_0 [ var_7 ] != ' ' and ( var_7 == 0 or var_0 [ var_7 - 1 ] == ' ' ) :
            var_4 += 1
    return var_4
