Heaps based approach to solve this easily...
\n\n# Code\n\nclass Solution:\n    def clearStars(self, s: str) -> str:\n        heap = []\n        for i,c in enumerate(s):\n            if c==\'*\':\n        
\n\n# Code\n```\nclass Solution:\n    def clearStars(self, s: str) -> str:\n        heap = []\n        for i,c in enumerate(s):\n            if c==\'*\':\n                heappop(heap)\n            else:\n                heappush(heap,(ord(c),-i))\n        \n        ans = [\'\']*len(s)\n        while heap:\n            ordChar,i = heappop(heap)\n            ans[-i] = chr(ordChar)\n            \n        return \'\'.join(ans)\n            \n        \n```
['Python', 'Java', 'Python3']