I have found many solutions on how to match multiple patterns in string, but didn’t find how to match a single string in many words.
The best way so far that I know is to use KMP algorithm for each of the words, but this isn’t so efficient(complexity = sum of words length), so I’m looking for some better algorithm to do so.
You have fundamentally misunderstood the problem. You can easily decompose the problem into finding all occurrences of a string in a word. This is done by combining each individual string into one large string (or word). Then you can iterate over this larger string once and use an efficient algorithm such as KMP or a regex (wouldn’t necessarily recommend using the regex though). An example to show what I mean:
Is equivalent to the following:
As Kevin pointed out in the comments the use of a delimiter here would prevent incorrect results from being generated.