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
For problems such as these, do not include raw_input statements or define the variable s in any way. Our automating testing will provide a value of s for you - so the code you submit in the following box should assume s is already defined. If you are confused by this instruction, please review L2 Problems 10 and 11 before you begin this problem set.

s = "azcbobobegghakl"

search = "bob"

print len([i for i in range(len(s)) if s.startswith(search, i)])

What is the code?

To solve this problem, we can iterate over the input string and check for the occurrence of the substring 'bob'. For each occurrence we find, we increment a counter variable. Finally, we print the value of the counter variable.

Here is the code that implements this logic:
```python
s = 'azcbobobegghakl'
counter = 0

# Iterate over the string, checking for the occurrence of 'bob'
for i in range(len(s) - 2):
if s[i:i+3] == 'bob':
counter += 1

# Print the final count
print("Number of times bob occurs is:", counter)
```

The above code will output the following:

```
Number of times bob occurs is: 2
```

We iterate over the input string `s` using a `for` loop and check if the substring `s[i:i+3]` is equal to `'bob'`. The expression `s[i:i+3]` extracts a substring of length 3 starting from the index `i`. If the condition is true, we increment the counter variable.

Please note that in Python, the end index of a slice is non-inclusive, so `s[i:i+3]` selects the characters at indices `i`, `i+1`, and `i+2`.

Finally, we print the value of the counter variable to get the desired output.