basic programming, strings
Chef wants to implement wildcard pattern matching supporting only the wildcard ‘?’. The wildcard character ‘?’ can be substituted by any single lower case English letter for matching. He has two strings X and Y of equal length, made up of lower case letters and the character ‘?’. He wants to know whether the strings X and Y can be matched or not.
We can reduce problem of matching two strings X and Y to matching individual characters for each index 0 \le i < N. If all characters can be matched, then we can say that both strings can also be matched.
MATCHING A CHARACTER
We need to check if two characters a and b can be matched or not. If either of them is ‘?’, then we can always match them by filling it with the required value. If both are ‘?’, still we can give any same value to both of them.
If both are not ‘?’, then we just need to check if the current values are same or not.
For implementation, see setter’s commented code.