Given a list of strings words, construct the shortest possible string S that contains every word from words as a substring at least once. You may concatenate the words in any order, and for each word you may choose to use it as-is or reversed. You must use each original word exactly once (but you can choose orientation). Overlaps are allowed when concatenating (i.e., a suffix of the current assembled string may overlap a prefix of the next chosen word/oriented word). If multiple shortest solutions exist, return the lexicographically smallest one. Return the resulting shortest superstring string S. Notes: - Each input word must appear at least once as a contiguous substring in S, counting when you used it (in chosen orientation). - You must place every word exactly once in your assembly sequence (but orientation for each can be normal or reversed). - Overlaps should be maximized to minimize final length. Example - Input: ["cat", "tac", "act"] - Output: "tacat" Explanation: One optimal assembly is: reverse("cat") -> "tac", then append "act" overlapping "ac", producing "tacat"; the word "tac" (original second word) appears already as substring. "tacat" has length 5 and is lexicographically smallest among length-5 solutions.
(["cat", "tac", "act"])"tacat"