comefrom: <doocs>0482.License Key Formatting_1.py
code: 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)
masked: def sample_funcname ( var_0 : str , var_1 : int ) -> str :
      var_0 = var_0.var_2 ( '-' , '' ).upper ( )
      var_3 = [ ]
      var_4 = ( len ( var_0 ) % var_1 ) or var_1
      var_5 = 0
      for var_6 , var_7 in enumerate ( var_0 ) :
          var_3.append ( var_7 )
          var_5 += 1
          if var_5 == var_4 :
              var_5 = 0
              var_4 = var_1
              if var_6 != len ( var_0 ) - 1 :
                  var_3.append ( '-' )
      return ''.join ( var_3 )
  