You are given a list of strings words from the vocabulary of an alien language, where the strings are sorted lexicographically by the rules of this new language.
Derive the order of letters in the alien alphabet and return it as a string. If no valid ordering exists (due to a contradiction or cycle), return "". If multiple valid orderings exist, return any one.
Only letters that appear in words should be included in the output.
words = ["wrt", "wrf", "er", "ett", "rftt"]
Input: words = ["wrt", "wrf", "er", "ett", "rftt"] Output: "wertf" Explanation: From adjacent pairs - t comes before f, w before e, r before t, e before r. Chain: w < e < r < t < f.
words = ["z", "x"]
Input: words = ["z", "x"]
Output: "zx"
Explanation: From the pair ("z", "x") we learn z comes before x.
words = ["z", "x", "z"]
Input: words = ["z", "x", "z"] Output: "" Explanation: z < x (from pair 1) and x < z (from pair 2) creates a cycle, so no valid ordering exists.
1 <= words.length <= 1001 <= words[i].length <= 100words[i] consists only of lowercase English letterswords = ["wrt", "wrf", "er", "ett", "rftt"]