Clean Python Solution (Self-Explained, Easy to Understand)
python\nclass Node(object):\n    def __init__(self, val):\n        self.val = val\n        self.key = None\n        self.children = {}\n\nclass Solution(object)
```python\nclass Node(object):\n    def __init__(self, val):\n        self.val = val\n        self.key = None\n        self.children = {}\n\nclass Solution(object):\n    def deleteDuplicateFolder(self, paths):\n        def setKey(node):\n            node.key = \'\'\n            for c in sorted(node.children.keys()): #need to be sorted. so when child structs are the same, we won\'t generate different key from different iteration order.\n                setKey(node.children[c])\n                node.key += node.children[c].val + \'|\' + node.children[c].key + \'|\' #generate a key for each node. only considering its children structure. (see the "identical" definition, it does not consider the val of the node itself.)\n                \n            keyCount[node.key] += 1\n        \n        def addPath(node, path):\n            if node.children and keyCount[node.key]>1: return #leaf node does not apply to this rule\n            ans.append(path+[node.val])\n            for c in node.children:\n                addPath(node.children[c], path+[node.val])\n            \n            \n        ans = []\n        root = Node(\'/\')\n        keyCount = collections.Counter()\n        \n        #build the tree\n        for path in paths:\n            node = root\n            for c in path:\n                if c not in node.children: node.children[c] = Node(c)\n                node = node.children[c]\n        \n        #set all nodes key recursively\n        setKey(root)\n\n        #build ans\n        for c in root.children:\n            addPath(root.children[c], [])\n        \n        return ans\n\t\t\n"""\nFor interview preparation, similar problems, check out my GitHub.\nIt took me a lots of time to make the solution. Becuase I want to help others like me.\nPlease give me a star if you like it. Means a lot to me.\nhttps://github.com/wuduhren/leetcode-python\n"""\n```
[]