Easy Heap
Complexity\n- Time complexity: O(n*log(n))\n\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def clearStars(self, s: str) -> str:\n        heap = []
# Complexity\n- Time complexity: $$O(n*log(n))$$\n\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution:\n    def clearStars(self, s: str) -> str:\n        heap = []\n        for i,ch in enumerate(s):\n            if ch != \'*\':\n                heappush(heap, (ch,-i))\n            else:\n                heappop(heap)\n        \n        sett = set(heap)\n\n        return \'\'.join(ch for i,ch in enumerate(s) if (ch,-i) in sett)\n```
['Heap (Priority Queue)', 'Python3']