General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Solution

%% An abcd string can consist of only a's and b's
abcd --> bc.

%% An abcd string can consist of an a followed by an abcd string
%% followed by a d
abcd --> onea, abcd, oned.

%% A bc string can be empty.
bc --> [].

%% Otherwise, it consists of two b's followed by a bc string followed
%% by two c's.
bc --> oneb, oneb, bc, onec, onec.

onea --> [a].
oneb --> [b].
onec --> [c].
oned --> [d].
    

Back to the exercise.