Rabbits and Rabbits
Submit solution
Points:
1
Time limit:
1.0s
Memory limit:
256M
Problem type
Allowed languages
C++, Python
DNA Sequence Comparison Problem
Long ago, there lived a group of rabbits in the forest.
One day, the rabbits decided to study their own DNA sequences.
First, they selected a very long DNA sequence (rabbits are aliens, so their DNA may contain all 26 lowercase English letters).
Then, they repeatedly choose two intervals and ask: if two rabbits are produced from the DNA sequences in these two intervals, will the rabbits be exactly the same?
Note that two rabbits are identical only if their DNA sequences are identical.
Input Format
- The first line contains a DNA string S.
- The second line contains an integer m, the number of queries.
- Next m lines each contain four integers l1, r1, l2, r2, describing the two intervals for the query. Positions in the string are numbered starting from 1.
Output Format
For each query, output a single line with the result:
- If the two rabbits are identical, output
Yes. - Otherwise output
No(case-sensitive).
Data Range
1 ≤ length(S), m ≤ 1,000,000
Sample Input
aabbaabb
3
1 3 5 7
1 3 6 8
1 2 1 2
Sample Output
Yes
No
Yes
Comments