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 105 times
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
- 280,205
- 27
- 317
- 514