#P1023A. Single Wildcard Pattern Matching
Single Wildcard Pattern Matching
No submission language available for this problem.
Description
You are given two strings and . The string consists of lowercase Latin letters and at most one wildcard character '*', the string consists only of lowercase Latin letters. The length of the string equals , the length of the string equals .
The wildcard character '*' in the string (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase Latin letters. No other character of can be replaced with anything. If it is possible to replace a wildcard character '*' in to obtain a string , then the string matches the pattern .
For example, if "aba*aba" then the following strings match it "abaaba", "abacaba" and "abazzzaba", but the following strings do not match: "ababa", "abcaaba", "codeforces", "aba1aba", "aba?aba".
If the given string matches the given string , print "YES", otherwise print "NO".
The first line contains two integers and () — the length of the string and the length of the string , respectively.
The second line contains string of length , which consists of lowercase Latin letters and at most one wildcard character '*'.
The third line contains string of length , which consists only of lowercase Latin letters.
Print "YES" (without quotes), if you can obtain the string from the string . Otherwise print "NO" (without quotes).
Input
The first line contains two integers and () — the length of the string and the length of the string , respectively.
The second line contains string of length , which consists of lowercase Latin letters and at most one wildcard character '*'.
The third line contains string of length , which consists only of lowercase Latin letters.
Output
Print "YES" (without quotes), if you can obtain the string from the string . Otherwise print "NO" (without quotes).
Samples
Note
In the first example a wildcard character '*' can be replaced with a string "force". So the string after this replacement is "codeforces" and the answer is "YES".
In the second example a wildcard character '*' can be replaced with an empty string. So the string after this replacement is "vkcup" and the answer is "YES".
There is no wildcard character '*' in the third example and the strings "v" and "k" are different so the answer is "NO".
In the fourth example there is no such replacement of a wildcard character '*' that you can obtain the string so the answer is "NO".