For any input string, we need to find super string by word match in any order. i.e. all words in the input string has to occur in any order in output string. e.g. given data set: "string search" "java string search" "manual c string search equals" "java search code" "c java code search" ...
input: "java search" output: 1) "java string search" 2) "java search code" 3) "c java code search"
input: "search c" output: 1) "manual c string search equals" 2) "c java code search"
This can be done in a very trivial way with word by word matching. Here mainly I am looking for an efficient algo.
Input: A few billion records in given data set (mostly 1 to 10 words length string). I need to find super string for millions of strings. Note: words are extended dictionary ones.