/**
 * This exercise aims to simulate the process of counting the occurrences of a gene sequence
 * within a given DNA sequence.
 *
 * @param geneSequence The gene sequence to be counted.
 * @param dnaSequence The DNA sequence where the gene sequence will be searched.
 * @return The total number of occurrences of the gene sequence in the DNA sequence.
 *
 * Example:
 * For geneSequence = "ATCG" and dnaSequence = "CGATCGATATCGCAGCGATC", the function should return 3.
 */
fun countGeneOccurrences(geneSequence: String, dnaSequence: String): Int {

    var count = 0

    for (i in 0 until dnaSequence.length - geneSequence.length + 1) {
        if (dnaSequence.substring(i, i + geneSequence.length) == geneSequence) {
            count++
        }
    }

    return count
}
/**
 * This exercise aims to simulate the process of counting the occurrences of a gene sequence
 * within a given DNA sequence.
 *
 * @param geneSequence The gene sequence to be counted.
 * @param dnaSequence The DNA sequence where the gene sequence will be searched.
 * @return The total number of occurrences of the gene sequence in the DNA sequence.
 *
 * Example:
 * For geneSequence = "ATCG" and dnaSequence = "CGATCGATATCGCAGCGATC", the function should return 3.
 */
fun countGeneOccurrences(geneSequence: String, dnaSequence: String): Int {
/**
 * This exercise aims to simulate the process of counting the occurrences of a gene sequence
 * within a given DNA sequence.
 *
 * @param geneSequence The gene sequence to be counted.
 * @param dnaSequence The DNA sequence where the gene sequence will be searched.
 * @return The total number of occurrences of the gene sequence in the DNA sequence.
 *
 * Example:
 * For geneSequence = "ATCG" and dnaSequence = "CGATCGATATCGCAGCGATC", the function should return 3.
 */
fun countGeneOccurrences(geneSequence: String, dnaSequence: String): Int {

    var count = 0

    for (i in 0 until dnaSequence.length - geneSequence.length + 1) {
        if (dnaSequence.substring(i, i + geneSequence.length) == geneSequence) {
            count++
        }
    }

    return count
}