Python3 faster than 100% using hints
\n\n\nclass Solution:\n    def sortString(self, s: str) -> str:\n\t\t#result string\n        result:str = ""\n        #Table of frequencies\n        freqTable =
![image](https://assets.leetcode.com/users/images/b4a47458-8dd3-4172-926f-75d59f0f9bad_1609902631.4732957.png)\n\n```\nclass Solution:\n    def sortString(self, s: str) -> str:\n\t\t#result string\n        result:str = ""\n        #Table of frequencies\n        freqTable = []\n        \'\'\'\n        create sorted set in order to pick unique character in ascending order -> step 1-2,\n        then do it again in descending order -> step 4-5\n        had to use "dict.fromkeys()" instead of set() to preserve the order of elements\n        \'\'\'\n        sortedSet = sorted(list(dict.fromkeys(s)))\n        #counting frequencies\n        for x in sortedSet:\n            freqTable.append(s.count(x))\n        \n        #while there are some unused characters with frequency > 0 -> step 7\n        while(sum(freqTable) != 0):\n            #appending characters in ascending order -> step 1-2-3\n            for i in range(len(sortedSet)):\n\t\t\t\t#if frequency of particular character is > 0 we can add it to our result string\n                if freqTable[i] > 0:\n                    result += sortedSet[i]\n\t\t\t\t\t#Decreasing frequency of a character\n                    freqTable[i] -= 1\n            #appending characters in descending order -> step 4-5-6\n            for i in range(len(sortedSet)-1, -1, -1):\n                if freqTable[i] > 0:\n                    result += sortedSet[i]\n                    freqTable[i] -= 1\n        return result\n```\n
['Python3']