i'm using python 3 and i would like to know how to count the amount of times a set of 3 letters comes up in a sentence:
con = ""
count = 0
for i in mystery_string:
    if i == "c":
        con = "c" 
    if i == "a" and con == "c":
        con = "ca"   
    if i == "t" and con == "ca":
        con = "cat"
    if con == "cat":
        count +=1
        con = ""
print (count)
this is the code i have so far, however it doesn't seem to work for every case can someone help me
the thing i also need to explain is that i cannot use the builtin function count()
 
     
     
    