<doocs>0482.License Key Formatting_1.py
def licenseKeyFormatting( s: str, k: int) -> str:
    s = s.replace('-', '').upper()
    res = []
    cnt = (len(s) % k) or k
    t = 0
    for i, c in enumerate(s):
        res.append(c)
        t += 1
        if t == cnt:
            t = 0
            cnt = k
            if i != len(s) - 1:
                res.append('-')
    return ''.join(res)
def sample_funcname ( var_0 : str , var_2 : int ) -> str :
    var_0 = var_0.var_4 ( '-' , '' ).upper ( )
    var_8 = [ ]
    var_10 = ( len ( var_0 ) % var_2 ) or var_2
    var_12 = 0
    for var_14 , var_15 in enumerate ( var_0 ) :
        var_8.append ( var_15 )
        var_12 += 1
        if var_12 == var_10 :
            var_12 = 0
            var_10 = var_2
            if var_14 != len ( var_0 ) - 1 :
                var_8.append ( '-' )
    return ''.join ( var_8 )
