Problem 3039 · Medium

Apply Operations to Make String Empty

Only the last copy of each letter with the largest count survives until the final round, so the answer keeps those positions in order.

Open the interactive visualisation