update WordBreak with DP and BFS