I need to write a regular expression for all words over $\{a,b,c\}$ not containing $aaa$, $bbb$ or $ccc$. Will appreciate any help. Note: this is not homework.

  • 1
    $\begingroup$ Try first not allowing repeats of size 2, and then see if you can extend this idea to your case. You can also construct a DFA/NFA and convert it to a regular expression. $\endgroup$ – Yuval Filmus May 22 '17 at 19:16
  • $\begingroup$ Welcome to CS.SE! We get asked this kind of question a lot, so we've written some general reference material for you: cs.stackexchange.com/q/45570/755, cs.stackexchange.com/q/1331/755. Please study that material, then try applying it to your problem, and see if you can solve it. If not, edit your question to show the approaches you've tried, the steps you've taken, what progress you made, and where specifically you got stuck. $\endgroup$ – D.W. May 22 '17 at 21:30