Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s. For example, if s = 'azcbobobegghakl', then your program should print
Number of times bob occurs is: 2
This is my answer, but i dont know what's wrong with my code. Please help
s = "azcbobobegghakl"
coutBob=0
i=0
for char in range (len(s)):
if char[i:i+3]=="bob":
coutBob+=1
else:
i=i+1
print ("Number of times bob occurs is: " + str(coutBob))