Problem 33: Prove that the language A = {x ∈ {0,1}* | #(01,x) = #(10,x)} is regular. (Here, for a, b ∈ {0,1}, #(ab,x) is the number of occurrences of a in x that are immediately followed by b.)
Recall that the canonical equivalence relation of a language A* is the binary relation =A on A* defined by x =A y if and only if, for all z ∈ A*, [xz ∈ A and yz ∈ A].