atcoder#ABC287D. [ABC287D] Match or Not

[ABC287D] Match or Not

Score : 400400 points

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.

a?c
b?
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.

atcoder
?????
Yes
Yes
Yes
Yes
Yes
Yes
beginner
contest
No
No
No
No
No
No
No
No