Loading repovive.com/problems/classics/39
Given a string of lowercase letters and queries, answer each query asking whether two substrings of are equal.
For each query , determine if the substring equals the substring (1-indexed, inclusive).
The substring 1..3 is
abc
, matching 4..6. The substring 1..2 is
ab
, while 5..6 is
bc
. The one-character substrings 2..2 and 5..5 are both
b
.
Positions 1 and 7 are both
r
. The substrings 1..3 (
rac
) and 5..7 (
car
) differ. The query 2..6 compared with itself is always equal.
All characters are
a
, so every pair of queried substrings with the same length is equal.