update inter leaving string

add dynamic programming