input:
pattern[1....m], and str[1.....n]
match[m][n] =
true; if m == 0 && n == 0
true; if n == 0 && m== 1 && pattern[m] == '*'
match[m-1][n-1]; if pattern[m] == str[n]
match[m-1][n] | match[m][n-1]; if pattern[m] == '*'
false; otherwise
the answer is in match[m][n]
ishtiak zaman
----------------
the world is nothing but a good program, and we are all some instances of the program
MATCHES FOR THE PATTERN: *
COMFILE.DAT
COST.DATA
CAT
MATCHES FOR THE PATTERN: *AL*
ALFRED
MATCHES FOR THE PATTERN: *A*PA
SEAPAMPA
MATCHES FOR THE PATTERN: *A*PAM
AQPAPAM
MATCHES FOR THE PATTERN: *AD*M*AD*M
ADPAPAMADFM
MATCHES FOR THE PATTERN: HELLO
HELLO
I'm also getting WA, my wildcard method seems ok and passes the tests above any special case worth considering?
I'm getting the lines with fgets and removing the trailing \n, should I bother removing spaces or is the input well formed?
playerX wrote:I'm also getting WA, my wildcard method seems ok and passes the tests above any special case worth considering?
I'm getting the lines with fgets and removing the trailing \n, should I bother removing spaces or is the input well formed?
cannot get rid of PE's. my output format for the sample inputs are
MATCHES FOR THE PATTERN: C*AT
COMFILE.DAT
CAT
COAT
//one blank line
MATCHES FOR THE PATTERN: *A*
MOUNTAIN.TXT
ALFRED
PROG1A
PROG1A.PAS
//one blank line
MATCHES FOR THE PATTERN: B**N*
BANANA
BNXJ.25
BORN
BRANDISH.SRD
BITNET
Press any key to continue_
i took input with gets, didnt remove any blanks, still PE.
ishtiak zaman
----------------
the world is nothing but a good program, and we are all some instances of the program