[Python3] Priority Queue + Greedy + Couting - Simple 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: $$O(NlogN)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(N)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def repeatLimitedString(self, s: str, repeatLimit: int) -> str:\n        cnt = collections.Counter(s)\n        chars = [(-ord(k), k, v) for k, v in cnt.items()]\n\n        heapq.heapify(chars)\n        res = []\n        while chars:\n            o, ch, ct = heapq.heappop(chars)\n            add = 0\n            if len(res) >= repeatLimit and res[-1] == ch:\n                if not chars: break\n                no, nch, nct = heapq.heappop(chars)\n                res.append(nch)\n                if nct - 1 != 0: heapq.heappush(chars, (no, nch, nct - 1))\n            else:\n                add = min(repeatLimit, ct)\n                res.extend([ch for _ in range(add)])\n            if ct - add != 0: heapq.heappush(chars, (o, ch, ct - add))\n        return "".join(res)\n```
['String', 'Greedy', 'Heap (Priority Queue)', 'Counting', 'Python3']