P10468 Rabbits and Rabbits
Description
A long, long time ago, a group of rabbits lived in a forest.
One day, the rabbits wanted to study their own DNA sequences.
We first take a very long DNA sequence (since little rabbits are alien creatures, the DNA sequence may contain $26$ lowercase English letters).
Then each time, we choose two intervals and ask: if we use the DNA sequences in the two intervals to produce two rabbits respectively, are these two rabbits exactly the same?
Note that two rabbits can be exactly the same only if their DNA sequences are exactly the same.
Input Format
The first line contains a DNA string $S$.
The second line contains an integer $m$, indicating there are $m$ queries.
The next $m$ lines each contain four integers $l_1, r_1, l_2, r_2$, representing the two intervals in this query. Note that the positions in the string are numbered starting from $1$.
Output Format
For each query, output one line showing the result.
If the two rabbits are completely the same, output `Yes`; otherwise output `No` (case-sensitive).
Explanation/Hint
Constraints: $1 \le |S|, m \le 10^6$. Here, $|S|$ is the length of the string $S$.
Translated by ChatGPT 5