title: How to create a program in python that prints the number of occurrence of words in a string
body: <p>I wanted to create a code that printed the frequency of words in a string and I did but I had a little problem though. Here's the code:</p>
  
  <pre><code>string=input("Enter your string: ")
  string=string.split()
  a=0
  while(a&lt;len(string)):
       print (string[a], "=", string.count(string[a]))
       a=a+1
  </code></pre>
  
  <p>Everything ran fine but if a word occurred twice, it'd say the word and state the occurrence in two places. I really need help here. Thanks!</p>