comefrom: <qiyuangong>068_Text_Justification_1.py
code: def fullJustify( words, maxWidth):
      res = []
      res_list = []
      curr = []
      count, pos = 0, 0
      while pos < len(words):
          word = words[pos]
          if len(word) > maxWidth:
              pos += 1
          if len(word) + count + len(curr)<= maxWidth:
              count += len(word)
              curr.append(word)
              pos += 1
          else:
              res_list.append(curr)
              curr = []
              count = 0
      if len(curr) > 0:
          res_list.append(curr)
      for index, curr in enumerate(res_list):
          text = ''
          remain = sum([len(t) for t in curr])
          if len(curr) == 1:
              text = curr[0] + ' ' * (maxWidth - remain)
          elif index == len(res_list) - 1:
              text = ' '.join(curr)
              text += ' ' * (maxWidth - remain - len(curr) + 1)
          else:
              step = (maxWidth - remain) / (len(curr) - 1 )
              extra = (maxWidth - remain) % (len(curr) - 1 )
              for index in range(len(curr) - 1):
                  text += curr[index] + ' ' * step
                  if extra > 0:
                      text += ' '
                      extra -= 1
              text += curr[-1]
          res.append(text)
      return res
masked: def sample_funcname ( var_0 , var_1 ) :
      var_2 = [ ]
      var_3 = [ ]
      var_4 = [ ]
      var_6 , var_7 = 0 , 0
      while var_7 < len ( var_0 ) :
          var_9 = var_0 [ var_7 ]
          if len ( var_9 ) > var_1 :
              var_7 += 1
          if len ( var_9 ) + var_6 + len ( var_4 ) <= var_1 :
              var_6 += len ( var_9 )
              var_4.append ( var_9 )
              var_7 += 1
          else :
              var_3.append ( var_4 )
              var_4 = [ ]
              var_6 = 0
      if len ( var_4 ) > 0 :
          var_3.append ( var_4 )
      for var_13 , var_4 in enumerate ( var_3 ) :
          var_15 = ''
          var_18 = sum ( [ len ( var_16 ) for var_16 in var_4 ] )
          if len ( var_4 ) == 1 :
              var_15 = var_4 [ 0 ] + ' ' * ( var_1 - var_18 )
          elif var_13 == len ( var_3 ) - 1 :
              var_15 = ' '.join ( var_4 )
              var_15 += ' ' * ( var_1 - var_18 - len ( var_4 ) + 1 )
          else :
              var_21 = ( var_1 - var_18 ) / ( len ( var_4 ) - 1 )
              var_22 = ( var_1 - var_18 ) % ( len ( var_4 ) - 1 )
              for var_13 in range ( len ( var_4 ) - 1 ) :
                  var_15 += var_4 [ var_13 ] + ' ' * var_21
                  if var_22 > 0 :
                      var_15 += ' '
                      var_22 -= 1
              var_15 += var_4 [ - 1 ]
          var_2.append ( var_15 )
      return var_2
  