Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s="bboobbobobbobbbbobboobnbobobbotbobbw"
- b=0
- o=0
- bob=0
- for char in s:
- if char=="b":
- b=1
- if char=="o" and b==1:
- o+=1
- if char=="o" and b==1 and o!=1:
- b=0
- o=0
- if char=="b" and o==1:
- bob+=1
- b=1
- o=0
- if char!="b" and char!="o":
- b=0
- o=0
- print('Number of times bob occurs is: '+str(bob))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement