bound edit distance
optimize with initial offset