#abc287d. D - Match or Not
D - Match or Not
Score : points
问题描述
给定由小写英文字母和?
组成的字符串 和 。这里,满足 (对于字符串 , 表示 的长度)。
若两个字符串 和 满足 ,则称它们 匹配 当且仅当:
- 可以通过独立地将 和 中的每个
?
替换为任意英文字母,使得 等于 。
对于每个 解决以下问题:
- 让 为通过不改变顺序的方式,连接 的前 个字符和后 个字符得到的长度为 的字符串。如果 和 匹配,则输出
Yes
,否则输出No
。
以上为通义千问 qwen-max 翻译,仅供参考。
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 .
Sample Input 1
a?c
b?
Sample Output 1
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.
Sample Input 2
atcoder
?????
Sample Output 2
Yes
Yes
Yes
Yes
Yes
Yes
Sample Input 3
beginner
contest
Sample Output 3
No
No
No
No
No
No
No
No
update @ 2024/3/10 12:00:03