Is the following language regular?

111 Views Asked by At

I believe that $$D = \{w: w \text{ has an equal number of occurrences of the 01 and 10 ranges}\}$$ is regular but can not create regular expression or DFA or NDFA.

Can I have a help.

1

There are 1 best solutions below

0
On

Hint: When you have seen a substring $01$, every subsequent occurrence of $1$ will not increase the number of substrings of the form $10$, but an occurrence of $0$ will. Likewise, when you see a substring $10$, every subsequent occurrence of $0$ will not increase the number of substrings of the form $01$, but an occurrence of $1$ will.