Solved String Matching problems with DP