{"raw_statement":[{"iden":"statement","content":"You are given two strings $s$ and $t$. The string $s$ consists of lowercase Latin letters and **at most one** wildcard character '_*_', the string $t$ consists only of lowercase Latin letters. The length of the string $s$ equals $n$, the length of the string $t$ equals $m$.\n\nThe wildcard character '_*_' in the string $s$ (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase Latin letters. No other character of $s$ can be replaced with anything. If it is possible to replace a wildcard character '_*_' in $s$ to obtain a string $t$, then the string $t$ matches the pattern $s$.\n\nFor example, if $s=$\"_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_\".\n\nIf the given string $t$ matches the given string $s$, print \"_YES_\", otherwise print \"_NO_\"."},{"iden":"input","content":"The first line contains two integers $n$ and $m$ ($1 \\le n, m \\le 2 \\cdot 10^5$) — the length of the string $s$ and the length of the string $t$, respectively.\n\nThe second line contains string $s$ of length $n$, which consists of lowercase Latin letters and **at most one** wildcard character '_*_'.\n\nThe third line contains string $t$ of length $m$, which consists only of lowercase Latin letters."},{"iden":"output","content":"Print \"_YES_\" (without quotes), if you can obtain the string $t$ from the string $s$. Otherwise print \"_NO_\" (without quotes)."},{"iden":"examples","content":"Input\n\n6 10\ncode*s\ncodeforces\n\nOutput\n\nYES\n\nInput\n\n6 5\nvk*cup\nvkcup\n\nOutput\n\nYES\n\nInput\n\n1 1\nv\nk\n\nOutput\n\nNO\n\nInput\n\n9 6\ngfgf*gfgf\ngfgfgf\n\nOutput\n\nNO"},{"iden":"note","content":"In the first example a wildcard character '_*_' can be replaced with a string \"_force_\". So the string $s$ after this replacement is \"_codeforces_\" and the answer is \"_YES_\".\n\nIn the second example a wildcard character '_*_' can be replaced with an empty string. So the string $s$ after this replacement is \"_vkcup_\" and the answer is \"_YES_\".\n\nThere is no wildcard character '_*_' in the third example and the strings \"_v_\" and \"_k_\" are different so the answer is \"_NO_\".\n\nIn the fourth example there is no such replacement of a wildcard character '_*_' that you can obtain the string $t$ so the answer is \"_NO_\"."}],"translated_statement":[{"iden":"statement","content":"你被给定两个字符串 $s$ 和 $t$。字符串 $s$ 由小写拉丁字母和至多一个通配符 '_*_' 组成，字符串 $t$ 仅由小写拉丁字母组成。字符串 $s$ 的长度为 $n$，字符串 $t$ 的长度为 $m$。\n\n字符串 $s$ 中的通配符 '_*_'（如果存在）可以被任意长度（包括空）的小写拉丁字母序列替换。$s$ 中的其他字符不能被替换。如果可以通过替换 $s$ 中的通配符 '_*_' 得到字符串 $t$，则称字符串 $t$ 匹配模式 $s$。\n\n例如，若 $s =$\"_aba*aba_\"，则以下字符串与之匹配：\"_abaaba_\"、\"_abacaba_\" 和 \"_abazzzaba_\"，但以下字符串不匹配：\"_ababa_\"、\"_abcaaba_\"、\"_codeforces_\"、\"_aba1aba_\"、\"_aba?aba_\"。\n\n如果给定的字符串 $t$ 匹配给定的字符串 $s$，请输出 \"_YES_\"，否则输出 \"_NO_\"。\n\n第一行包含两个整数 $n$ 和 $m$ ($1 lt.eq n, m lt.eq 2 dot.op 10^5$) —— 分别表示字符串 $s$ 和 $t$ 的长度。\n\n第二行包含长度为 $n$ 的字符串 $s$，由小写拉丁字母和至多一个通配符 '_*_' 组成。\n\n第三行包含长度为 $m$ 的字符串 $t$，仅由小写拉丁字母组成。\n\n如果你能从字符串 $s$ 得到字符串 $t$，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。\n\n在第一个例子中，通配符 '_*_' 可以被字符串 \"_force_\" 替换。因此替换后的字符串 $s$ 为 \"_codeforces_\"，答案为 \"_YES_\"。\n\n在第二个例子中，通配符 '_*_' 可以被空字符串替换。因此替换后的字符串 $s$ 为 \"_vkcup_\"，答案为 \"_YES_\"。\n\n在第三个例子中，字符串中没有通配符 '_*_'，且字符串 \"_v_\" 和 \"_k_\" 不同，因此答案为 \"_NO_\"。\n\n在第四个例子中，不存在任何对通配符 '_*_' 的替换方式能获得字符串 $t$，因此答案为 \"_NO_\"。"},{"iden":"input","content":"第一行包含两个整数 $n$ 和 $m$ ($1 lt.eq n, m lt.eq 2 dot.op 10^5$) —— 分别表示字符串 $s$ 和 $t$ 的长度。第二行包含长度为 $n$ 的字符串 $s$，由小写拉丁字母和至多一个通配符 '_*_' 组成。第三行包含长度为 $m$ 的字符串 $t$，仅由小写拉丁字母组成。"},{"iden":"output","content":"如果你能从字符串 $s$ 得到字符串 $t$，请输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。"},{"iden":"examples","content":"输入\n6 10\ncode*s\ncodeforces\n输出\nYES\n\n输入\n6 5\nvk*cup\nvkcup\n输出\nYES\n\n输入\n1 1\nv\nk\n输出\nNO\n\n输入\n9 6\ngfgf*gfgf\ngfgfgf\n输出\nNO"},{"iden":"note","content":"在第一个例子中，通配符 '_*_' 可以被字符串 \"_force_\" 替换。因此替换后的字符串 $s$ 为 \"_codeforces_\"，答案为 \"_YES_\"。在第二个例子中，通配符 '_*_' 可以被空字符串替换。因此替换后的字符串 $s$ 为 \"_vkcup_\"，答案为 \"_YES_\"。在第三个例子中，字符串中没有通配符 '_*_'，且字符串 \"_v_\" 和 \"_k_\" 不同，因此答案为 \"_NO_\"。在第四个例子中，不存在任何对通配符 '_*_' 的替换方式能获得字符串 $t$，因此答案为 \"_NO_\"。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ s \\in (\\Sigma \\cup \\{*\\})^n $ be a pattern string of length $ n $, where $ \\Sigma $ is the set of lowercase Latin letters, and $ * $ denotes at most one wildcard character.  \nLet $ t \\in \\Sigma^m $ be a target string of length $ m $.  \n\nLet $ p \\in \\{0, 1\\} $ indicate the presence of the wildcard:  \n- $ p = 1 $ if $ * $ appears exactly once in $ s $,  \n- $ p = 0 $ if $ * $ does not appear in $ s $.  \n\nLet $ s_{\\text{left}} \\in \\Sigma^* $ be the prefix of $ s $ before the wildcard (if any), and $ s_{\\text{right}} \\in \\Sigma^* $ be the suffix of $ s $ after the wildcard (if any).  \nIf $ p = 0 $, then $ s_{\\text{left}} = s $ and $ s_{\\text{right}} = \\varepsilon $ (empty string).  \n\n**Constraints**  \n1. $ 1 \\le n, m \\le 2 \\cdot 10^5 $  \n2. $ s $ contains at most one occurrence of $ * $  \n3. $ t $ contains only characters from $ \\Sigma $  \n\n**Objective**  \nDetermine whether there exists a string $ w \\in \\Sigma^* $ such that:  \n$$\ns = s_{\\text{left}} + * + s_{\\text{right}} \\quad \\Rightarrow \\quad s_{\\text{left}} + w + s_{\\text{right}} = t\n$$  \nEquivalently:  \n- If $ p = 0 $: $ s = t $  \n- If $ p = 1 $: $ t = s_{\\text{left}} + w + s_{\\text{right}} $ for some $ w \\in \\Sigma^* $, i.e.,  \n  $$\n  t[0:|s_{\\text{left}}|] = s_{\\text{left}} \\quad \\text{and} \\quad t[m - |s_{\\text{right}}|:m] = s_{\\text{right}} \\quad \\text{and} \\quad |s_{\\text{left}}| + |s_{\\text{right}}| \\le m\n  $$  \n\n**Output**  \n$$\n\\begin{cases}\n\\text{YES} & \\text{if such } w \\text{ exists} \\\\\n\\text{NO} & \\text{otherwise}\n\\end{cases}\n$$","simple_statement":null,"has_page_source":false}