how to implement sequence detector (multiple sequence)
Recognizing a sequence of symbols is known as "lexical analysis", or more colloquially, "scanning" or "lexing". It's actually a huge topic in software, where an input grammar needs to be broken into meaningful tokens as efficiently as possible. There's a whole process that involves writing a formal grammar for the sequences to be recognized, converting that grammar first to a NFA (nondeterministic finite automaton) and then to a DFA (deterministic finite automaton). The DFA can be described by a table of state transitions that drives a relatively simple and efficient interpreter.

Your problem is a vastly simplified version of that &mdash; only two symbols and just two fixed sequences that need to be recognized. It should be solvable pretty much by inspection, without requiring all of the formalism described above.

Just start drawing state diagrams for recognizers for the sequences individually, then look for common sub-sequences and valid end states as you try to combine them into one master state machine.

Here's the diagram that I came up with:



The states across the top are the recognizer for "0010", with the final transition that has the output "1" going down to the "10" state, since the last part of this pattern corresponds to the first part of the "100" pattern. Similarly, the states across the bottom are the recognizer for "100", with the final transition going to the "00" state in the top row.