title: TimeLimitError when removing all occurrences of a string from another string
body: <p>I'm doing an exercise in which I have to remove all occurrences of a string from another string and, although it works, it seems that the program is iterating and infinite amount of times and I can't fix it. I know there is a string.replace() function but I wanted to try to solve the problem without using the fuction.
  This is the code:</p>
  <p>'''
  def remove_all(substr,theStr):</p>
  <pre><code>index = theStr.find(substr)
  if index &gt; 0:
      newstr = &quot;&quot;
      while index &gt; 0:
          sizsub = len(substr)
          newstr = theStr[:index] + theStr[(index + len(substr)):]
          index = newstr.find(substr)
      return newstr
  else:
      return theStr
  </code></pre>
  <p>remove_all(&quot;an&quot;, &quot;banana&quot;)</p>
  <p>'''</p>
  <p>the error message: &quot;TimeLimitError: Program exceeded run time limit. on line 9&quot;</p>
  <p>Thanks in advance.</p>