>:</span>
            <span class="n">pos_j</span> <span class="o">+=</span> <span class="mi">1</span>

    <span class="k">assert</span> <span class="n">pos_i</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">==</span> <span class="n">end_i</span> <span class="ow">and</span> <span class="n">pos_j</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">==</span> <span class="n">end_j</span>

    <span class="k">return</span> <span class="n">pd</span><span class="o">