"""
Exercise 2: Longest Word in Dictionary (LeetCode 720)

Return the longest word that can be built one character at a time by other
words in the list (every prefix must also be a word). Ties: the
lexicographically smallest.
"""

def longest_word(words):
    # TODO
    return ""


# --- self-check: do not modify below this line ---
a = longest_word(["w", "wo", "wor", "worl", "world"])
b = longest_word(["a", "banana", "app", "appl", "ap", "apply", "apple"])
c = longest_word(["b", "a"])
print(a, b, c)
print("PASS" if (a, b, c) == ("world", "apple", "a") else "FAIL")
