Application of Myhill-Nerode theorem. DFA minimization.