Introduction to the theory of automata