Flexible Mining of Prefix Sequences from Time-Series Traces