Replace and Keep Sorted

Problem Name:
Replace and Keep Sorted
Site:CodeForces
Links:
Tags:
Problem setters: