Library

DFA · Regular

Every a is followed by a b

Each a must be immediately answered by a b: the words of (b | ab)*. A request that is still waiting when the input ends is a rejection.

okwaitingbab
The machine as drawn — 2 states, 3 transitions.Every word up to length 8, one row per length in shortlex order, inked where it is accepted.

The author’s examples, run

ε → acceptbabb → acceptb → acceptababababbb → accepta → rejectaabb → rejectba → rejectaaabababbb → reject