A Martingale Approach to the Study of Occurrence of Sequence Patterns in Repeated Experiments