Aho-Corasick algorithm as implemented in Java by Danny Yoo, with little improvements