From: Efficient algorithms for biological stems search
Non-matching region
Matching region
d x ≤d
0≤i≤d x
d−max(i,d x −i)
d x >d
d x −d≤i≤d