parameters: (self, s)
return_statement: return "".join(stk)
docstring: :type s: str
          :rtype: str
docstring_summary: :type s: str
          :rtype: str
docstring_tokens: : type s : str : rtype : str
function: def removeDuplicateLetters(self, s):
          """
          :type s: str
          :rtype: str
          """
          remaining = Counter(s)
  
          in_stack, stk = set(), []
          for c in s:
              if c not in in_stack:
                  while stk and stk[-1] > c and remaining[stk[-1]]:
                      in_stack.remove(stk.pop())
                  stk += c
                  in_stack.add(c)
              remaining[c] -= 1
          return "".join(stk)
function_tokens: def removeDuplicateLetters ( self , s ) : remaining = Counter ( s ) in_stack , stk = set ( ) , [ ] for c in s : if c not in in_stack : while stk and stk [ - 1 ] > c and remaining [ stk [ - 1 ] ] : in_stack . remove ( stk . pop ( ) ) stk += c in_stack . add ( c ) remaining [ c ] -= 1 return "" . join ( stk )