human
I found an interesting problem on https://leetcode.com/problems/remove-duplicate-letters/:
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
 
Example 1:
 
 
Input: "bcabc"
Output: "abc"
 
 
Example 2:
 
 
Input: "cbacdcbc"
Output: "acdb"

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is the Python program you requested.

class Solution:
     def removeDuplicateLetters(self, s):
         if not s:
             return ""
         
         res = ''
         sorted_set = sorted(set(s))
         
         for c in sorted_set:
             sub_s = s[s.index(c):]
             if set(s) == set(sub_s):
                 return c + self.removeDuplicateLetters(sub_s.replace(c, ''))
         
                 
         return res