CS402 Assignment Solution No. 1 Shared by Zulfiqar Ahmad Zakki

No Comments

Question 1: [Marks: 10]

Σ = {a, b}

Write a Regular Expression, that only accepts strings with exactly two or three a’s in the string. There is no restriction on occurrence of b’s in the string.

Few examples of accepted strings are as under;
- bbaabbbba
- baba
- aba
- abaa
- aa
- aaa
etc.


Ans:
I think the RE will be like this:
b*ab*ab*  + b*ab*ab*ab*




Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment