void BuildPath(map<string, vs> &traces, vvs &pathes, vs &path, string word, string start){ if(word == start){ path.push_back(word); vs tmp = path; reverse(tmp.begin(), tmp.end()); pathes.push_back(tmp); path.pop_back(); return; } path.push_back(word); vs tmp = traces[word]; for(int i = 0; i < tmp.size(); ++i) BuildPath(traces, pathes, path, tmp[i], start); path.pop_back(); }