[Python] Simple solution faster than 100%- Using 2 pointers + sorting
Hi ,\n\nHere is a simple solution.   Please Upvote if you like!\n\nNote: \n\t\tletters = sorted(list(c.keys())+[\'\']) is to take care of the edgecase when seco
Hi ,\n\nHere is a simple solution.   Please **Upvote** if you like!\n\nNote: \n\t\tletters = sorted(list(c.keys())+[\'\']) is to take care of the edgecase when `second` is None\n\n```\n\n    def repeatLimitedString(self, s: str, repeatLimit: int) -> str:\n\t\n        c = collections.Counter(s)\n        res = []\n        letters = sorted(list(c.keys())+[\'\'])\n\n        first,second = letters.pop(),letters.pop()\n\n        while first and second:\n            if c[first] > repeatLimit:\n                c[first] -= repeatLimit\n                res += first * repeatLimit\n                res += second\n                c[second] -= 1\n                if c[second]==0:\n                    second = letters.pop()\n\n            else:\n                res += first * c[first]\n                c[first] = 0\n                first = second\n                second = letters.pop()\n        if first:      \n            res += first * min(c[first], repeatLimit)\n        return \'\'.join(res)\n         \n
['Python']