I Want to Create Regular Expression from string of {a,b} that it contains neither the substring ab NOR ba?How I can do it?
Asked
Active
Viewed 101 times
-1
-
What now, regular expression or DFA? – Raphael Oct 22 '17 at 19:54
1 Answers
0
If a string over $\{a,b\}$ contains neither $ab$ nor $ba$ as a substring, then all of its letters must be the same (why?). You can use this to create a regular expression for the language of all such strings.

Yuval Filmus
- 276,994
- 27
- 311
- 503