Recursive solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def sortString(self, s: str) -> str:\n        s = list(sorted(s))\n        res = \'\'\n        temp = list(sorted(set(s)))\n        for char in temp:\n            res+=char\n            s.remove(char)\n        if len(s) >0:\n            revTemp = list(sorted(set(s),reverse=True))\n            for char in revTemp:\n                res+=char\n                s.remove(char)\n        if len(s) >0:\n            k = \'\'\n            for char in s:\n                k+= char\n            s = k\n            return res + self.sortString(s)\n\n        else:\n            return res\n    \n        \n        \n```
['Python3']