def count_ocurrency(txt, pat) -> int:
s = len(txt)
x = len(pat)
count = 0
for i in range(s - x + 1):
j = 0
for n in range(x):
if txt[i + n] != pat[n]:
break
j +=1
if j == x:
count += 1
return count
print(count_ocurrency("abac", "abbc"))
To embed this project on your website, copy the following code and paste it into your website's HTML: