This is an instance of a simple state machine. The initial state is S0. When a 0 is detected at the input the state transits to S1, S2, S3, and S4. However once 1 is detected, the state returns to S0. Output becomes 1 only when the state machine is in 4 state (Figure 1.1). Transitions without conditions are default.
Figure: Lab 9 State Transition Diagram