Wildcard string matching
Submissions: 1459   Accuracy:

21.18%

  Difficulty: Basic   Marks: 1

Given two strings where first string may contain wild card characters and second string is a normal string. Write a function that returns true if the two strings match. The following are allowed wild card characters in first string.

* --> Matches with 0 or more instances of any character 
      or set of characters.
? --> Matches with any one character.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two strings, a string with wildcard and one without.

Output:
Print "Yes" (without quotes) if the two strings match else print "No" (without quotes).

Constraints:
1<=T<=10^5
1<=length of the two string<=10^5

Example:
Input:

2
ge*ks
geeks
ge?ks*
geeksforgeeks

Output:
Yes
Yes

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.