AhoCorasickautomatoner
The Aho-Corasick automaton is a string searching algorithm that finds all occurrences of a finite set of keywords in a text in a single pass. It is an extension of the Knuth-Morris-Pratt algorithm and uses a finite automaton to perform the search. The automaton is built by first constructing a trie (prefix tree) of all the keywords. Then, failure links are added to the trie. These failure links point to the longest proper suffix of the current node's string that is also a prefix of another keyword.
During the search phase, the algorithm traverses the text and the automaton simultaneously. When a character
The Aho-Corasick algorithm has a time complexity of O(n + m + k), where n is the length