input: Write a python function to count the number of times a substring appears in a given string.
  assert count_substr("abcdabcd", "cd") == 2
  assert count_substr("aaaa", "aa") == 3
  assert count_substr("mississippi", "iss") == 2
output: def count_substr(s, sub):
      count = start = 0
      while True:
          start = s.find(sub, start) + 1
          if start > 0:
              count += 1
          else:
              return count