$('h3').each(function() {
    const $headline = $(this);
    if ($headline.next().is('h2, h3')) {
      $headline.remove();
    }