C++ Trie cleaned-up code, no duplicated data
The version down below is actually the same as most others. It\'s just a little bit cleaned up.\nE.g. there is no need to store the name twice in the trie node 
The version down below is actually the same as most others. It\'s just a little bit cleaned up.\nE.g. there is no need to store the name twice in the trie node as it\'s already in the children map.\nThere\'s no flags marking the nodes to delete. This is to keep the trie node universal and reusable, i.e. the code to mark thos nodes is splitted in a separate unordered_map.\nOtherwise, there are only to functions to operate on the generated trie - deduplicate, which collects all the nodes it should later avoid collecting in getPaths, which basicalle just reconstructs the paths from the trie taking into account the before mentioned statement.\n\n```\nstruct Trie {\n    void insert(const vector<string>& path) {\n        auto node = this;\n        for (auto& p: path) {\n            if (!node->children.count(p)) {\n                node->children[p] = make_unique<Trie>();\n            }\n            node = node->children[p].get();\n        }\n    }\n    map<string, unique_ptr<Trie>> children;    \n};\n\nclass Solution {\n    Trie root;\n    \n    map<string, Trie*> seen;\n    unordered_set<Trie*> toDelete;\n    \n    string deduplicate(Trie* node) {\n        \n        string path;        \n        for (auto& [s, n]: node->children) {   \n            path += s + deduplicate(n.get());\n        }        \n        if (path.empty()) return "";\n        \n        if (seen.count(path)) {\n            toDelete.insert(seen[path]);\n            toDelete.insert(node);\n        } else seen[path] = node;     \n        \n        return "(" + path + ")";\n    }\n    \n    void getPaths(Trie* node, vector<vector<string>>& paths, vector<string>& path) {\n        for (auto& [s, n]: node->children) {\n            if (toDelete.count(n.get())) continue;\n            path.push_back(s);\n            getPaths(n.get(), paths, path);\n            path.pop_back();\n        }\n        \n        if (!path.empty()) paths.push_back(path);\n    }\npublic:\n    vector<vector<string>> deleteDuplicateFolder(vector<vector<string>>& paths) {\n        for (auto& path: paths) root.insert(path);\n        paths.clear();\n        deduplicate(&root);\n        getPaths(&root, paths, vector<string>() = {});\n        return paths;\n    }\n};\n```
['Depth-First Search', 'Trie', 'C', 'C++']