✅Easy Java Solution || Beginners Friendly 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public String clearStars(String s) {
        PriorityQueue<Pair<Character, Integer>> pq = new PriorityQueue<>(
            new Comparator<Pair<Character, Integer>>() {
                public int compare(Pair<Character, Integer> p1, Pair<Character, Integer> p2) {
                    if(Character.compare(p1.getKey(), p2.getKey()) == 0) {
                        return Integer.compare(p2.getValue(), p1.getValue());
                    }
                    return Character.compare(p1.getKey(), p2.getKey());
                }
            }
        );
        StringBuilder sb = new StringBuilder(s);
        for(int i=0; i<sb.length(); i++) {
            if(Character.compare(sb.charAt(i), '*') != 0) {
                pq.offer(new Pair(sb.charAt(i), i));
            } else {
                if(!pq.isEmpty()) {
                    Pair<Character, Integer> pair = pq.poll();
                    sb.setCharAt(pair.getValue(), '_');
                    sb.setCharAt(i, '_');
                }
            }
        }
        return sb.toString().replaceAll("_", "");
    }
}
```
['Java']