Merging rests automatically

When two (or more) voices on a staff share common rests, common engraving practice merges these rests into one. The following snippet takes care of that, automatically. Please note that multi-measure rests are not automatically combined.