CCSM: an Efficient Algorithm for Constrained Sequence Mining