Solution (source code)

= Solution

A grammar $G=(\Sigma,V,P,S)$ is a right-linear <regular grammar> when every production has one of the forms
$$
\boxed{A\to wB\quad\text{or}\quad A\to w,}
$$
where $A,B\in V$ and $w\in\Sigma^*$. Thus a production has at most one variable on its right-hand side, and that variable is at the right end.