<doocs>0696.Count Binary Substrings_1.py
def countBinarySubstrings( s: str) -> int:
    i, n = 0, len(s)
    t = []
    while i < n:
        cnt = 1
        while i + 1 < n and s[i + 1] == s[i]:
            cnt += 1
            i += 1
        t.append(cnt)
        i += 1
    ans = 0
    for i in range(1, len(t)):
        ans += min(t[i - 1], t[i])
    return ans
def sample_funcname ( var_0 : str ) -> int :
    var_4 , var_6 = 0 , len ( var_0 )
    var_7 = [ ]
    while var_4 < var_6 :
        var_9 = 1
        while var_4 + 1 < var_6 and var_0 [ var_4 + 1 ] == var_0 [ var_4 ] :
            var_9 += 1
            var_4 += 1
        var_7.append ( var_9 )
        var_4 += 1
    var_11 = 0
    for var_4 in range ( 1 , len ( var_7 ) ) :
        var_11 += min ( var_7 [ var_4 - 1 ] , var_7 [ var_4 ] )
    return var_11
