atcoder#ABC287D. [ABC287D] Match or Not
[ABC287D] Match or Not
Score : points
Problem Statement
You are given strings and consisting of lowercase English letters and ?
. Here, holds (for a string , denotes the length of ).
Two strings and such that is said to match if and only if:
- one can make equal by replacing each
?
in and with any English letter independently.
Solve the following problem for each :
- Let be the string of length obtained by concatenating the first characters and the last characters of without changing the order. Print
Yes
if and match, andNo
otherwise.
Constraints
- and are strings consisting of lowercase English letters and
?
.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer for .
a?c
b?
Yes
No
No
When , equals ?c
. Here, we can replace the -st character of , ?
, with b
and the -nd character of , ?
, with c
to make equal , so and match. Thus, Yes
should be printed in the first line.
When and , respectively, is ac
and a?
, neither of which matches with . Thus, No
should be printed in the second and third lines.
atcoder
?????
Yes
Yes
Yes
Yes
Yes
Yes
beginner
contest
No
No
No
No
No
No
No
No