comefrom: <doocs>1370.Increasing Decreasing String_1.py
code: def sortString( s: str) -> str:
      counter = [0] * 26
      for c in s:
          counter[ord(c) - ord('a')] += 1
      ans = []
      while len(ans) < len(s):
          for i in range(26):
              if counter[i]:
                  ans.append(chr(i + ord('a')))
                  counter[i] -= 1
          for i in range(25, -1, -1):
              if counter[i]:
                  ans.append(chr(i + ord('a')))
                  counter[i] -= 1
      return ''.join(ans)
masked: def sample_funcname ( var_0 : str ) -> str :
      var_4 = [ 0 ] * 26
      for var_5 in var_0 :
          var_4 [ ord ( var_5 ) - ord ( 'a' ) ] += 1
      var_9 = [ ]
      while len ( var_9 ) < len ( var_0 ) :
          for var_12 in range ( 26 ) :
              if var_4 [ var_12 ] :
                  var_9.append ( chr ( var_12 + ord ( 'a' ) ) )
                  var_4 [ var_12 ] -= 1
          for var_12 in range ( 25 , - 1 , - 1 ) :
              if var_4 [ var_12 ] :
                  var_9.append ( chr ( var_12 + ord ( 'a' ) ) )
                  var_4 [ var_12 ] -= 1
      return ''.join ( var_9 )
  