DP solution to word break