Solution (source code)

= Solution

Extend $\delta:Q\times\Sigma\to Q$ to
$$
\widehat\delta:Q\times\Sigma^*\to Q
$$
by
$$
\widehat\delta(q,\varepsilon)=q,
\qquad
\widehat\delta(q,wa)=\delta(\widehat\delta(q,w),a).
$$
The <extended transition function of a deterministic finite automaton> processes a whole word from left to right. The language accepted by $D$ is
$$
\boxed{L(D)=\{w\in\Sigma^*:\widehat\delta(q_0,w)\in F\}.}
$$