Skip to content

Instantly share code, notes, and snippets.

@niklatkin
Created May 9, 2018 15:23
Show Gist options
  • Save niklatkin/2a77570571419b2d7e9bde74f2186c24 to your computer and use it in GitHub Desktop.
Save niklatkin/2a77570571419b2d7e9bde74f2186c24 to your computer and use it in GitHub Desktop.
s = 'azcbobobegghakl'
l = 0
count = 0
x = len(s)
for i in s:
if i == "b" and l+1 < x and l+2 <x:
if (s[l+1] == "o" and s[l+2]=="b"):
count = count + 1
l = l + 1
print("Number of times bob occurs is: "+str(count))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment