Hi, I was trying to solve a problem which goes like this:
Given a list of N strings and another list of M strings, output the shortest string (of lower case English letters) that contains all N initiation words as substrings and none of the M forbidden words.If there are multiple answers, output any one of them. If there are no answers, output a “-” in a single line.
Constraints:
N ≥ 1, M ≥ 0, and 1 ≤ N + M ≤ 15.
The sum of the lengths of all strings in one test case does not exceed 320.
Somehow, I think this is related to Aho-Corasick but can't exactly figure out how. Need some direction here.
Thanks!