#P10468. Rabbit DNA Sequence Comparison
Rabbit DNA Sequence Comparison
Rabbit DNA Sequence Comparison
Long ago, in a forest, a group of rabbits lived peacefully. One day, the rabbits decided to study their own DNA sequences. They selected a very long DNA sequence (since the little rabbits are aliens, the DNA sequence may contain 26 lowercase English letters, i.e. \(26\) letters).
Then they repeatedly chose two intervals from the DNA sequence and asked: if we were to produce two rabbits using the DNA segments from these intervals respectively, would the two rabbits be exactly identical? Note that two rabbits can be identical if and only if their DNA sequences are exactly the same.
inputFormat
The first line contains a string s
representing the DNA sequence. It consists of lowercase English letters.
The second line contains an integer q
, the number of queries.
Each of the following q
lines contains four integers l1 r1 l2 r2
representing two intervals. The intervals are 1-indexed. The substring from l1
to r1
and the substring from l2
to r2
are the DNA sequences to compare.
outputFormat
For each query, output a single line containing Yes
if the two selected substrings are exactly the same, or No
otherwise.
sample
abcabc
3
1 3 4 6
2 4 1 3
1 1 4 4
Yes
No
Yes
</p>