s and store it in a hash map.repeatLimit times, reducing its frequency accordingly.
c. If the frequency of the character is not exhausted, check if there is a next largest character in the priority queue.
d. If there is, append that character once to the result string and re-insert it into the priority queue if it still has a remaining frequency.
e. Re-insert the original character into the priority queue if it still has a remaining frequency.