Grasshopper Interview Question

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