\begin{solution}{4}
    See figure \ref{fig:9.4}.

    \begin{figure*}[t]
        \centering
        \begin{tikzpicture}[->, node distance=2cm]
            \node[state,initial] (q0) {$q_0$};
            \node[state] (q1) [right=of q0] {$q_1$};
            \node[state] (q2) [right=of q1] {$q_2$};
            \node[state] (q3) [right=of q2] {$q_3$};
            \node[state] (q4) [right=of q3] {$q_4$};
            \node[state] (q5) [right=of q4] {$q_5$};
            \draw (q0) -- node[above] {$B/B,R$} ++ (q1);
            \draw (q1) -- node[above] {$a/a,R$} ++ (q2);
            \draw (q2) -- node[above] {$a/a,R$} ++ (q3);
            \draw (q3) -- node[above] {$a/a,R$} ++ (q4);
            \draw (q4) -- node[above] {$c/c,L$} ++ (q5);
            \draw (q1) edge[loop above] node[above,align=left] {$B/B,R$\\$b/b,R$\\$c/c,R$} (q1);
            \draw (q2) edge[bend left] node[below,align=left] {$B/B,R$\\$b/b,R$\\$c/c,R$} (q1);
            \draw (q3) edge[bend right] node[above,align=left] {$B/B,R$\\$b/b,R$\\$c/c,R$} (q1);
            \draw (q4) edge[bend left] node[below,align=left] {$B/B,R$\\$b/b,R$} (q1);
            \draw (q4) edge[loop above] node[above,align=left] {$a/a,R$} (q4);
            \draw (q5) edge[loop above] node[above,align=left] {$a/a,L$\\$b/b,L$\\$c/c,L$} (q5);
        \end{tikzpicture}
        \caption{The state machine of exercise 9.4.}
        \label{fig:9.4}
    \end{figure*}
\end{solution}

