Similar questions 2 more →
Finite Automata

Answer & solution
Answer: States q0,q1,q2 accepting, qD rejecting; start q0; a resets q0 before death; b advances q0→q1→q2→qD; qD loops. (no official key was published)
Step through it (2 parts)
While no forbidden substring has appeared, only the length of the trailing run of b characters matters. State q0 means zero trailing b's, q1 one, and q2 two. A third consecutive b makes the input permanently unacceptable, represented by rejecting sink qD.
Transition diagram as a complete edge list:
q0 --a--> q0; q0 --b--> q1
q1 --a--> q0; q1 --b--> q2
q2 --a--> q0; q2 --b--> qD
qD --a,b--> qD.
Start at q0; accepting states are q0,q1,q2. In particular epsilon is accepted, and bb is accepted but bbb is not.
Induct on the processed prefix: before a forbidden block occurs, the named state records its trailing b count; an a resets that count and a b increments it. Upon reaching three, qD is entered and can never be escaped, so later a's cannot erase an earlier violation. This invariant proves both acceptance of every valid string and rejection of every invalid one. Four states are also minimal: qD differs from all accepting states on epsilon, and q0,q1,q2 can be distinguished by appending b or bb as appropriate.