#dna_finder by Jay ©2022 - JayWebsites
#feel free to edit!
#for non-commercial use only

#ask for input from the user
print("( if you need a random DNA string to analyze go here:")
print("http://www.faculty.ucr.edu/~mmaduro/random.htm )\n")
jays_dna = input("Enter the DNA sequence u want to analyze for CCC:\n")

#initialize the counter at 0
count = 0

#search the DNA string with a for loop
for x in jays_dna:
    #count up if a C is found, or count down if some other letter is found
    if x == "C":
        count = count+1
    else:
        count = count-1
    #make sure the counter never goes below 0 and print count
    if count < 0:
        count = 0
    print(x)
    #if 3 C's are found, print a message and reset counter
    if count == 2:
        print(x)
        print("We have found a CCC sequence in the DNA!")
        count = 0
print("\n\nC ya later!")
   
        
    
