implement subst engine with Aho Corasick algorithm