A multiset allows duplicate elements unlike regular sets. Insert the value 5 three times and all three copies remain in the container, maintained in sorted order. Use ms.count(value) to get how many copies of a value exist.
When erasing by value, all copies are removed at once. To remove just one copy, erase by iterator instead. Multisets are useful for maintaining sorted data where duplicates matter, like finding the median in a sliding window or tracking multiple occurrences in sorted order.