title: To print the count of occurrences of a word ending with "on" in python
body: <pre><code>my_string = """Strings are gameon amongst gameon the most popular data types in Python. We can create the strings by enclosing characters briton in quotes. Python treats briton single quotes the same as double quotes."""
  def count_words(string):
      for word in string.split():
          if word.endswith("on") == True:
              print(word,":",string.count(word))
              string = string.replace(word,'')
  count_words(my_string)
  </code></pre>
  
  <p>I want to print all the words and their occurences in a word if they end with "on". I am getting something like </p>
  
  <pre><code>gameon : 2
  gameon : 0
  briton : 2
  Python : 2
  briton : 0
  </code></pre>
  
  <p>this even after removing the word. 
  Why it is repeating? </p>
  
  <p>Edit: I can't use any module. Only logic.</p>