#abc287d. D - Match or Not

D - Match or Not

Score : 400400 points

问题描述

给定由小写英文字母和?组成的字符串 SSTT。这里,满足 S>T|S| \gt |T|(对于字符串 XXX|X| 表示 XX 的长度)。

若两个字符串 XXYY 满足 X=Y|X|=|Y|,则称它们 匹配 当且仅当:

  • 可以通过独立地将 XXYY 中的每个 ? 替换为任意英文字母,使得 XX 等于 YY

对于每个 x=0,1,,Tx=0,1,\ldots,|T| 解决以下问题:

  • SS' 为通过不改变顺序的方式,连接 SS 的前 xx 个字符和后 (Tx)(|T|-x) 个字符得到的长度为 T|T| 的字符串。如果 SS'TT 匹配,则输出 Yes,否则输出 No

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given strings SS and TT consisting of lowercase English letters and ?. Here, S>T|S| \gt |T| holds (for a string XX, X|X| denotes the length of XX).

Two strings XX and YY such that X=Y|X|=|Y| is said to match if and only if:

  • one can make XX equal YY by replacing each ? in XX and YY with any English letter independently.

Solve the following problem for each x=0,1,,Tx=0,1,\ldots,|T|:

  • Let SS' be the string of length T|T| obtained by concatenating the first xx characters and the last (Tx)(|T|-x) characters of SS without changing the order. Print Yes if SS' and TT match, and No otherwise.

Constraints

  • SS and TT are strings consisting of lowercase English letters and ?.
  • 1T<S3×1051 \leq |T| \lt |S| \leq 3 \times 10^5

Input

The input is given from Standard Input in the following format:

SS

TT

Output

Print (T+1)(|T|+1) lines.
The ii-th line should contain the answer for x=i1x=i-1.

Sample Input 1

a?c
b?

Sample Output 1

Yes
No
No

When x=0x=0, SS' equals ?c. Here, we can replace the 11-st character of SS', ?, with b and the 22-nd character of TT, ?, with c to make SS' equal TT, so SS' and TT match. Thus, Yes should be printed in the first line.
When x=1x=1 and 22, respectively, SS' is ac and a?, neither of which matches with TT. 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