resolve Wildcard_Matching by DP