#P7879. Readable Text Queries

    ID: 21064 Type: Default 1000ms 256MiB

Readable Text Queries

Readable Text Queries

In this problem, you are given an article represented by a string tt and another string ss. Little A only recognizes words that are substrings of ss of length at least kk. A text is called readable if and only if it can be segmented into one or more words that little A understands. Formally, a text TT is readable if there exists a segmentation [ T = w_1 w_2 \cdots w_m \quad (m \ge 1), ] such that for each ii, the word wiw_i is a substring of ss with ( |w_i| \ge k ).

You will process qq operations on the article tt. There are two types of operations:

  1. Type 1 (Update): Given indices ll and rr (1-indexed) and a string xx (with ( |x| = r-l+1 )), replace the substring t[l:r]t[l:r] with xx.

  2. Type 2 (Query): Given indices ll and rr, check whether the substring t[l:r]t[l:r] is readable. Output Yes if it is readable, and No otherwise.

Note: In all operations, indices are 1-indexed.

Example: Let k=2k=2, s=abcds=\texttt{abcd}. Then:

  • The string abcd is readable (it is itself a substring of $s$).
  • The string abc is readable.
  • The string cdab is readable since it can be segmented as cd / ab.
  • The string ab is not readable if it cannot be segmented such that each segment has length at least $2$.

Your task is to simulate these operations and answer each query accordingly.

inputFormat

The input is given as follows:





op1 p1 p2 [x] 
op2 p1 p2
... (q operations total)

Here,

  • The first line contains the initial article string $t$.
  • The second line contains the string $s$.
  • The third line contains an integer $k$.
  • The fourth line contains an integer $q$, the number of operations.
  • Each of the next $q$ lines describes an operation. An operation starts with an integer describing its type.
    • If the type is 1, it is followed by two integers $l$ and $r$ and a string $x$ (with length $r-l+1$).
    • If the type is 2, it is followed by two integers $l$ and $r$.

All indices are 1-indexed.

outputFormat

For each operation of Type 2, output a single line containing either Yes if the specified substring is readable, or No otherwise.

sample

abc
abcd
2
3
2 1 3
1 2 3 xx
2 1 3
Yes

No

</p>