One algorithm for wildcard

xiaoxiao2021-03-05  25

#include #include #include Using Namespace STD;

CHAR DP_MATCH (const char * str2) {int Slen1 = Strlen (str1); int Slen2 = Strlen (STR2); char Match [100] [100]; MEMSET (Match, 0, 100 * 100); Match [0] [0] = 1; INT I, J, K, M; For (i = 1; i <= Slen1; i) {for (j = 1; j <= Slen2; J) IF (Match [I-1]) IF (str1 [i-1] == STR2 [J-1] || STR2 [J-1] == '?') Match [i] [J ] = 1; ELSE IF (STR2 [J-1] == '*') for (k = I-1; K <= Slen1; K) Match [K] [J] = 1; for (k = 1; K <= Slen2; K) IF (Match [I] [K]) Break; if (k> Slen2) Return 0;} returnome;}} returnome

INT main () {int TMP = 0; char List1 [100], list2 [100]; cin >> list1 >> list2; tmp = dp_match (list1, list2); cout << TMP; System ("pause"); }

Originally posted address: http://community.9cbs.net/expert/topic/3937/3937794.xml? Temp = .4352838

转载请注明原文地址:https://www.9cbs.com/read-35691.html

New Post(0)