Meta interview question

String manipulation (DFS)