Finding the CFG (Context Free Grammar) of a language

858 Views Asked by At

Can we write a CFG (Context Free Grammar) for the set of all non-empty string whose length are multiple of 3 on the alphabet $ \Sigma = \{A,R,G,C\} $

1

There are 1 best solutions below

2
On

Hint. A non-empty word whose length is a multiple of $3$ has either length $3$ or consist of a non-empty word whose length is $3$ and a non-empty word whose length is a multiple of $3$.