dynamic programming for word break