Sequential test


A main program enters a valid DNA string and a valid DNA sequence (“valid” means they are not empty and consist exclusively of an arbitrary combination of “a”, “t”, “g” or “c”). Write a valid function that returns true if the entry is valid, false otherwise. Write an entered function that performs a valid entry and returns the entered value as a string. Write a proportion function that takes two arguments, the string and the sequence, and returns the proportion of sequence in the string (that is, its number of occurrences).

The main program calls the function entered for the string and for the sequence and displays the result. Sample display: There is 13.33% of “ca” in your channel.


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incidi. Lorem ipsum dolor sit amet, consectet dolor sit amet, consectetur adipiscing elit