While I am studying formal languages, I see these questions.What are the answers for them?
a) The set of strings over {a, b, c} that begin with a, contain exactly two b’s, and end with cc.
b) The set of strings of even length over {a, b, c} that contain exactly one a.
c) The set of strings over {a, b} that contains an even number of substrings ba.
Best Answer
$a)$ The leading $a$ and trailing $cc$ are explicitly placed in the expression: $$a(a∪c)^∗b(a∪c)^∗b(a∪c)^∗cc$$ Any number of $a’s$ and $c’s$, represented by the expression $(a∪c)^∗$, may surround the two $b’s$.
$b)$ Let $S=\{b, c\}$. Then, in steps:
$c)$ The set of strings over $\{a, b\}$ that contains an even number of substrings $ba$ :
$$a^*(b^+a^+b^+a)^+b^*$$