To solve the problem:
- Understand which words are in L.
I actually did this part for you: L defines that any words in that language start with any number (including 0) of a or b, followed by 1 or more as, follwoed by one b, maybe followed by any number of as, followed by the same character it started with (or a repetition of them).
- Read one grammar. See if you can construct words with this grammar that are not in L.
- See if you can find words in L that can not be constructed by this grammar
- If you find either, proceed with the next grammar
- if you find none, the grammar successfully generates L.
solved generating grammars from a language (formal languages and automata theory)