Block interview question

BFS on input strings