Context-Free Grammars & Languages

Answer & solution
Answer: S→ABAC|BAC|AAC|ABC|AC|BC|d; A→aA|a; B→bB|b; C→d. (no official key was published)
The nullable nonterminals are A and B. C is not nullable because it must produce d; S is consequently not nullable. In S→ABAC, independently retain or omit each of the two occurrences of A and the one occurrence of B. The distinct right sides are ABAC, BAC, AAC, ABC, AC, BC and C. The side AC arises twice because either A can be the sole retained A, but duplicate productions need only be written once.
Removing A→ε and B→ε requires adding the terminating alternatives A→a and B→b: their old recursive rules could previously terminate by using the nullable final nonterminal. Keep A→aA|a and B→bB|b, so these variables now generate positive rather than arbitrary nonnegative repetitions. Keep C→d.
The only unit production introduced is S→C. Substitute C's nonunit right side to obtain S→d, then delete S→C. The resulting grammar is S→ABAC|BAC|AAC|ABC|AC|BC|d, A→aA|a, B→bB|b, C→d.
Every rule now has a nonempty right side; none has a sole nonterminal. The original language is {ai bj ak d:i,j,k≥0}. The seven start alternatives cover exactly which of the three repetition blocks are empty, with the all-empty case producing d. Thus the transformation preserves the language, including the shortest word d.