':type words: List[str]
:rtype: str'

def alienOrder(self, words):

    (nodes, ancestors) = (sets.Set(), {})
    for i in xrange(len(words)):
        for c in words[i]:
            nodes.add(c)
    for node in nodes:
        ancestors[node] = []
    for i in xrange(1, len(words)):
        if ((len(words[(i - 1)]) > len(words[i])) and (words[(i - 1)][:len(words[i])] == words[i])):
            return ''
        self.findEdges(words[(i - 1)], words[i], ancestors)
    result = []
    visited = {}
    for node in nodes:
        if self.topSortDFS(node, node, ancestors, visited, result):
            return ''
    return ''.join(result)
