

実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 250 点
問題文
英小文字と ?
からなる文字列 T と、英小文字のみからなる文字列 U が与えられます。
T は、英小文字のみからなる文字列 S のちょうど 4 文字を ?
で置き換えることで得られた文字列です。
S が U を連続部分文字列として含んでいた可能性があるかどうか判定してください。
制約
- T は長さ 4 以上 10 以下の英小文字と
?
からなる文字列 - T にはちょうど 4 つの
?
が含まれる - U は長さ 1 以上 |T| 以下の英小文字からなる文字列
入力
入力は以下の形式で標準入力から与えられる。
T U
出力
S が U を部分文字列として含んでいた可能性があるならば Yes
を、そうでないならば No
を出力せよ。
入力例 1
tak??a?h? nashi
出力例 1
Yes
例えば、S が takanashi
である場合、これは nashi
を連続部分文字列として含みます。
入力例 2
??e??e snuke
出力例 2
No
?
がどのような文字であっても、S は snuke
を連続部分文字列として含むことがありません。
入力例 3
???? aoki
出力例 3
Yes
Score : 250 points
Problem Statement
You are given a string T consisting of lowercase English letters and ?
, and a string U consisting of lowercase English letters.
The string T is obtained by taking some lowercase-only string S and replacing exactly four of its characters with ?
.
Determine whether it is possible that the original string S contained U as a contiguous substring.
Constraints
- T is a string of length between 4 and 10, inclusive, consisting of lowercase letters and
?
. - T contains exactly four occurrences of
?
. - U is a string of length between 1 and |T|, inclusive, consisting of lowercase letters.
Input
The input is given from Standard Input in the following format:
T U
Output
Print Yes
if it is possible that the original string S contained U as a contiguous substring; otherwise, print No
.
Sample Input 1
tak??a?h? nashi
Sample Output 1
Yes
For example, if S is takanashi
, it contains nashi
as a contiguous substring.
Sample Input 2
??e??e snuke
Sample Output 2
No
No matter what characters replace the ?
s in T, S cannot contain snuke
as a contiguous substring.
Sample Input 3
???? aoki
Sample Output 3
Yes