S3 Graphics interview question

design a statemachine to detect the pattern "101" in a 1-bit input stream.