# Is this Moore Diagram designed to identify a sequence Correct?

I have to make a Moore Diagram in order to identify the following sequence: BABBAA Two conditions: It shouldn't stop and it should be able to detect overlapped sequences. I don't really know if it is correct and as you can see by the question mark between the state E3 and the state E2 with input A, I don't really know if that is fine. Could anyone point the mistakes I made on this diagram or if its correct?

I've picked up on just one mistake. From E7, when input is "B", it should go to E2, not E4. E4 is supposed to have detected the sequence "BAB", but the way you have connected this would relate to a "BAAB" sequence. All else seems fine.

state | sequence | in = A | in = B
==================================
E1  | ""       |   E1   |   E2
E2  | "B"      |   E3   |   E2
E3  | "BA"     |   E1   |   E4
E4  | "BAB"    |   E3   |   E5
E5  | "BABB"   |   E6   |   E2
E6  | "BABBA"  |   E7   |   E4
E7  | "BABBAA" |   E1   |   E2


At E7 you have detected the sequence of BABBAA, next if you get A you are correctly going to E1 to start over, but if you get B, your sequence becomes ABBAAB, and there was no BAB in the last three values which is what is expected at E4 so you cant go there. The overlapping sequence can start from B so you can go back to E2. Between, the question is too specific so watch out for moderators..