<doocs>0639.Decode Ways II_1.py
def numDecodings( s: str) -> int:
    mod = int(1e9 + 7)
    n = len(s)
    
    a, b, c = 0, 1, 0
    for i in range(1, n + 1):
        if s[i - 1] == "*":
            c = 9 * b % mod
        elif s[i - 1] != "0":
            c = b
        else:
            c = 0
    
        if i > 1:
            if s[i - 2] == "*" and s[i - 1] == "*":
                c = (c + 15 * a) % mod
            elif s[i - 2] == "*":
                if s[i - 1] > "6":
                    c = (c + a) % mod
                else:
                    c = (c + 2 * a) % mod
            elif s[i - 1] == "*":
                if s[i - 2] == "1":
                    c = (c + 9 * a) % mod
                elif s[i - 2] == "2":
                    c = (c + 6 * a) % mod
            elif (
                s[i - 2] != "0"
                and (ord(s[i - 2]) - ord("0")) * 10 + ord(s[i - 1]) - ord("0") <= 26
            ):
                c = (c + a) % mod
    
        a, b = b, c
    
    return c
def sample_funcname ( var_0 : str ) -> int :
    var_5 = int ( 1e9 + 7 )
    var_7 = len ( var_0 )
    var_9 , var_11 , var_12 = 0 , 1 , 0
    for var_14 in range ( 1 , var_7 + 1 ) :
        if var_0 [ var_14 - 1 ] == "*" :
            var_12 = 9 * var_11 % var_5
        elif var_0 [ var_14 - 1 ] != "0" :
            var_12 = var_11
        else :
            var_12 = 0
        if var_14 > 1 :
            if var_0 [ var_14 - 2 ] == "*" and var_0 [ var_14 - 1 ] == "*" :
                var_12 = ( var_12 + 15 * var_9 ) % var_5
            elif var_0 [ var_14 - 2 ] == "*" :
                if var_0 [ var_14 - 1 ] > "6" :
                    var_12 = ( var_12 + var_9 ) % var_5
                else :
                    var_12 = ( var_12 + 2 * var_9 ) % var_5
            elif var_0 [ var_14 - 1 ] == "*" :
                if var_0 [ var_14 - 2 ] == "1" :
                    var_12 = ( var_12 + 9 * var_9 ) % var_5
                elif var_0 [ var_14 - 2 ] == "2" :
                    var_12 = ( var_12 + 6 * var_9 ) % var_5
            elif ( var_0 [ var_14 - 2 ] != "0" and ( ord ( var_0 [ var_14 - 2 ] ) - ord ( "0" ) ) * 10 + ord ( var_0 [ var_14 - 1 ] ) - ord ( "0" ) <= 26 ) :
                var_12 = ( var_12 + var_9 ) % var_5
        var_9 , var_11 = var_11 , var_12
    return var_12
