Hints
If you want to solve this problem on your own without looking at the hints, solve 1132F : Clear the String first. Note that this recommendation is not for a similar problem or topic, but rather for a problem that will help you build your intuition and thought process. I’ve also added hints.
If you find the above problem too difficult, try 1901D: Yet Another Monster Fight. This will help you in thinking in the right direction instead of trying random things or greedy strategy. Hints are available