import re

string = 'abcdcdc'
sub_string = 'cdc'

count = len(re.findall('(?=%s)' % sub_string, string))

print(count)