MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / search

Method search

code/strings/aho_corasick.cpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 while (out->next) out = out->next;
36 out->next = s->fail->out; } } } } }
37 vector<string> search(string s) {
38 vector<string> res;
39 go_node *cur = go;
40 iter(c, s) {
41 while (cur && cur->next.find(*c) == cur->next.end())
42 cur = cur->fail;
43 if (!cur) cur = go;
44 cur = cur->next[*c];
45 if (!cur) cur = go;
46 for (out_node *out = cur->out; out; out = out->next)
47 res.push_back(out->keyword); }
48 return res; } };
49// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected