Interpreting a suffix-tracking DFA
Finite Automata

Answer & solution
Official answer: C
Approach: Assign each state the longest suffix of the input read so far that is also a prefix of the pattern bab.
The prefixes are ε,b,ba,bab, corresponding respectively to q0,q1,q2,q3. At q0 an a leaves no nonempty matching suffix, while b starts the match. At q1 another b still leaves suffix b, while a extends it to ba. At q2, b completes bab, but a leaves no matching suffix and returns to q0.
After reaching q3, an a leaves suffix ba and returns to q2; a b leaves suffix b and returns to q1. Therefore acceptance records that the current complete word ends in bab, not merely that bab appeared at some earlier position. This proves C.
B fails because baba contains bab but ends at nonaccepting q2. A fails because the empty word has an even b-count but is rejected. D fails because a avoids aba yet is rejected.




