# GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 26

Identity the language generated by following grammar where S is the start variable.

```S → AB
A → aAb | ε
B → bBc | ε```

(A) L = { aibjck | i, j, k ≥ 0, and i+k > j }
(B) L = { aibjck | i, j, k ≥ 0, and i+j = k }
(C) L = { aibjck | i, j, k ≥ 0, and i+k = j }
(D) L = { aibjck | i, j, k ≥ 0, and i+j > k }

Explanation: In this case, the first thing we observe is that we can still accept the empty string by setting A and B as ε.

Next, we construct the string using our variables A and B.
The variable A here ensures that we have an equal number of a’s and b’s for every occurence of A.
The variable B allows us to have an equal number of b and c, for every occurence of B.

Hence, the number of b’s is the sum of number of a’s and c’s

L = { aibjck | i, j, k ≥ 0, and i+k = j }

Option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.