✅ Java Solution
CODE\nJava []\npublic String clearStars(String s) {\n\tchar[] arr = s.toCharArray();\n\n\tPriorityQueue<Integer> pq = new PriorityQueue<>((i,j)->{\n\t\tif(arr[i
## **CODE**\n```Java []\npublic String clearStars(String s) {\n\tchar[] arr = s.toCharArray();\n\n\tPriorityQueue<Integer> pq = new PriorityQueue<>((i,j)->{\n\t\tif(arr[i] == arr[j]) return j-i;\n\t\treturn arr[i]-arr[j];\n\t});\n\n\tfor(int i=0; i<arr.length; i++) {\n\t\tif(arr[i] == \'*\') {\n\t\t\tint top = pq.remove();\n\t\t\tarr[top] = \'-\';\n\t\t} else {\n\t\t\tpq.add(i);\n\t\t}\n\t}\n\n\tString res = "";\n\tfor(char ch : arr) {\n\t\tif(ch != \'*\' && ch != \'-\') {\n\t\t\tres += ch;\n\t\t} \n\t}\n\n\treturn res;\n}\n```
['Java']