title: A program to find number of occurrences of a sub-string in a string without using library function
body: <p>So far I have reached here, but program always returns 1. 
  I don't want to use library function. Please help!
  Since, I'm a beginner I want the code to be as simple as possible. Thanks!  </p>
  
  <pre><code>str = input("Enter The String: ")
  substr = input("Enter The Sub-String: ")
  l = len(str)
  count = 0
  es = ''
  for i in range (l):
      es += str[i]
      if es == substr:
         if str[i+1] != ' ':
            count = 0
          else:
              count += 1
              es = ''
  print (count)
  </code></pre>