Grasshopper interview question

DFS (Depth-First Search) and another and string manipulation