Wednesday, March 8, 2017

Find a sub string

s=str(input('Please enter your string: ')).lower()
numberofbob=0
i=0
length=len(s)
print (length)
for i in range (len(s)):
    print (s[i:i+3])
    if s[i:i+3] == 'bob' :
        numberofbob+=1
print (numberofbob)

No comments:

Post a Comment