equal no. of occurences of string in DFA

How is this come?

1Comment
Sumit Verma @sumitverma
6 Dec 2016 03:54 pm

The language given is  L = { w | w contains an equal no of occurrences of substring 'ab' and 'ba' }.
Note- aba ∈ L since 'aba' contains one occurrence of 'ab' and one occurrence of 'ba' but  abab ∉ L .
This is a regular language because we can write regular expression for the language.
(b+a*b+)* + (a+b*a+)*
The NFA accepting the language L will be:

 

Pages