Fix bug in the DP algorithm used for checking if a string belongs to concatenation