Answer:
S -> LSR
S -> M
M -> YYY
Y -> c | g
L -> XX
X -> b | c | g
R -> ZZZ
Z -> a | b
Step-by-step explanation:
This is a long time ago, but I think this does what you want.
Start symbol S expands to LSR and allows you to grow L and R on either side as much as you want. Ultimately S must be replaced by M. Then you have a pattern like LLLLLMRRRRR.
We can then further break down L into 2 times b, c or g, and similar for M and R.