#P10468. 兔子与兔子

兔子与兔子

Problem 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 2626 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 SS.

The second line contains an integer mm, indicating there are mm queries.

The next mm lines each contain four integers l1,r1,l2,r2l_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 11.

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).

aabbaabb
3
1 3 5 7
1 3 6 8
1 2 1 2
Yes
No
Yes

Hint

Constraints: 1S,m1061 \le |S|, m \le 10^6. Here, S|S| is the length of the string SS.

Translated by ChatGPT 5