Comparison of substrings
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given a string S, you need to determine if two specified substrings are equal for multiple queries.
Input
The first line contains the string S where the length of S is between 1 and
10^5
.The second line contains an integer m, the number of queries, where 1 ≤ m ≤
10^5
.Each of the following m lines contains four integers: a, b, c, and d, representing the indices of the substrings.
Output
For each query, print "Yes" if the substrings [S[a]
...S[b]
] and [S[c]
...S[d]
] are identical, otherwise print "No".
Examples
Input #1
Answer #1
Submissions 265
Acceptance rate 16%