Chef and the Wildcard Matching
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian as well.
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.
The first line of input contain an integer T denoting the number of test cases. Each test case consists of two lines, the first line contains the string X and the second contains the string Y.
For each test case, output a single line with the word Yes if the strings can be matched, otherwise output No.
- 1 ≤ T ≤ 50
- Both X and Y have equal length and the length is between 1 and 10.
- Both X and Y consist of lower case letters and the character '?'.
Input: 2 s?or? sco?? stor? sco?? Output: Yes No
First Example: There are several ways the two strings can be matched, one of those is "score".
Second Example: There is no way to match the strings.
|Tags||basic-prog, cakewalk, cook61, implementation, rustinpiece, strings|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.