Company: TCS codevita
Difficulty: medium
Sequence Detector Nitya is a digital circuit designer. She decides to design a sequence detector which may be either an overlapping model or a non-overlapping model. Sequence detector is a digital circuit which is used to detect the sequences from a series of numbers. These detectors may be overlapping or non-overlapping. Example of how non-overlapping sequence detector detects sequence 101 is depicted below: 101001011010001101 So, from the series given above, say Series 1, non-overlapping sequence detector detects four 101 sequences. Example of how overlapping sequence detector detects sequence 101 is depicted below: 1011001010 From the series given above, say Series 2, overlapping sequence detector detects three 101 sequences. The last 5 digits in the given series i.e., 10101 has two middle 1 is used by both left and right trailing digits. Input Format Input consists of variable number of lines of input where each line contains 4 space separated inputs which represents present_state