string = 'abcdcdc'
sub_string = 'cdc'
start = count = 0
while True:
index = string.find(sub_string, start)
if index >= 0:
start = index + 1
count += 1
else:
break
print(count)
c3RyaW5nID0gJ2FiY2RjZGMnCnN1Yl9zdHJpbmcgPSAnY2RjJwoKc3RhcnQgPSBjb3VudCA9IDAKd2hpbGUgVHJ1ZToKICAgIGluZGV4ID0gc3RyaW5nLmZpbmQoc3ViX3N0cmluZywgc3RhcnQpCiAgICBpZiBpbmRleCA+PSAwOgogICAgICAgIHN0YXJ0ID0gaW5kZXggKyAxCiAgICAgICAgY291bnQgKz0gMQogICAgZWxzZToKICAgICAgICBicmVhawoKcHJpbnQoY291bnQp