Tavas and Malekas
HardRating 1900CodeforcesString Algorithms (KMP, Z, Hashing)
Approach hintTry it first, then revealHide
Two forced occurrences at distance d < |p| are consistent exactly when p has a border of length |p| - d, which the Z-function of p checks in O(1). Every uncovered position is then free, giving a power of 26.