title: Removing multiple substrings from a text with index
body: <p>I have a long text, and I am trying to remove multiple substrings using start and end index. The problem here is that when I remove the first substring from the original text, the rest of the start and end indexes will be invalid. what is the most efficient way to do this?</p>
  <pre><code>def remove_substrings(text, indexes):
      '''
          indexes is a list containing start and end indexes.
          indexes = [&quot;3 5&quot;, &quot;7 8&quot;]
      '''
  
      return text
  </code></pre>