<doocs>1419.Minimum Number of Frogs Croaking_1.py
def minNumberOfFrogs( croakOfFrogs: str) -> int:
    c = r = o = a = k = ans = 0
    for ch in croakOfFrogs:
        if ch == 'c':
            c += 1
            if k > 0:
                k -= 1
            else:
                ans += 1
        elif ch == 'r':
            r += 1
            c -= 1
        elif ch == 'o':
            o += 1
            r -= 1
        elif ch == 'a':
            a += 1
            o -= 1
        else:
            k += 1
            a -= 1
        if c < 0 or r < 0 or o < 0 or a < 0:
            return -1
    return -1 if c != 0 or r != 0 or o != 0 or a != 0 else ans
def sample_funcname ( var_0 : str ) -> int :
    var_9 = var_3 = var_4 = var_5 = var_6 = var_7 = 0
    for var_10 in var_0 :
        if var_10 == 'c' :
            var_9 += 1
            if var_6 > 0 :
                var_6 -= 1
            else :
                var_7 += 1
        elif var_10 == 'r' :
            var_3 += 1
            var_9 -= 1
        elif var_10 == 'o' :
            var_4 += 1
            var_3 -= 1
        elif var_10 == 'a' :
            var_5 += 1
            var_4 -= 1
        else :
            var_6 += 1
            var_5 -= 1
        if var_9 < 0 or var_3 < 0 or var_4 < 0 or var_5 < 0 :
            return - 1
    return - 1 if var_9 != 0 or var_3 != 0 or var_4 != 0 or var_5 != 0 else var_7
