How to would you find out whether a substring occurs in a given string?
Sigiloso
If the query string isn't going to change that often, then it might be a hint to use KMP. Since it creates a "matching-table" for all the characters in the query string - so irrespective of the text we are going to be searching in and given that the query string doesn't search that often KMP can provide an O(n) solution.