Pattern Search using Automata Algorithm