Python solution
\n        s = []\n        for i,t in enumerate(text):\n            if t not in s:\n                while s and ord(t) <= ord(s[-1]) and s[-1] in text[i+1:]:\n  
```\n        s = []\n        for i,t in enumerate(text):\n            if t not in s:\n                while s and ord(t) <= ord(s[-1]) and s[-1] in text[i+1:]:\n                    s.pop()\n                s.append(t)\n        \n        return \'\'.join(s)\n```
[]