Search code examples
finite-automata

What is the regular expression for The set of all strings of a's, b's, and c's that contain at least two a's


What is the regular expression for The set of all strings of a's, b's, and c's that contain at least two a's.can anybody help me?


Solution

  • See try to break it into simple language. All we want is atleast 2 a's doesn't matter where their position is and there is not condition on count and position of b and c. So it should go like

    (a+b+c)* .a. (a+b+c)* .a. (a+b+c)*

    Any combination of a,b,c followed by a followed by again any combination of a,b,c followed by a which fullfils our condition then any combination of a,b,c.