JavaScript is required

Văn phạm gồm các luật sinh: S->bA; S->aB; A->a B->b; A->aS B- >bS; A->bAA B- >aBB sinh ra được chuỗi nào?

A.

aaaabb

B.

aabbbb

C.

aabbab

D.

abbbba

Trả lời:

Đáp án đúng: C


The grammar generates strings of the form a^n b^m or b^n a^m, where n, m >= 1. Let's examine the options. None of the provided options can be generated by this grammar because it needs to have an equal or almost equal number of a's and b's.

Câu hỏi liên quan