/**
 * This function counts the number of occurrences of a specific target sequence in a given DNA sequence.
 *
 * @param sequence The DNA sequence to search for the target sequence.
 * @param target The specific target sequence to count the occurrences of.
 * @return The count of occurrences of the target sequence in the DNA sequence.
 */
fun countDnaSequence(sequence: String, target: String): Int {

    var count = 0
    try {
        var index = 0
        while (true) {
            index = sequence.indexOf(target, index)  // Find the next occurrence of the target sequence
            count++  // Increment the count
            index++  // Move to the next index to continue searching
        }
    } catch (e: IndexOutOfBoundsException) {
        // Do nothing, just exit the loop
    }
    return count
}
/**
 * This function counts the number of occurrences of a specific target sequence in a given DNA sequence.
 *
 * @param sequence The DNA sequence to search for the target sequence.
 * @param target The specific target sequence to count the occurrences of.
 * @return The count of occurrences of the target sequence in the DNA sequence.
 */
fun countDnaSequence(sequence: String, target: String): Int {
/**
 * This function counts the number of occurrences of a specific target sequence in a given DNA sequence.
 *
 * @param sequence The DNA sequence to search for the target sequence.
 * @param target The specific target sequence to count the occurrences of.
 * @return The count of occurrences of the target sequence in the DNA sequence.
 */
fun countDnaSequence(sequence: String, target: String): Int {

    var count = 0
    try {
        var index = 0
        while (true) {
            index = sequence.indexOf(target, index)  // Find the next occurrence of the target sequence
            count++  // Increment the count
            index++  // Move to the next index to continue searching
        }
    } catch (e: IndexOutOfBoundsException) {
        // Do nothing, just exit the loop
    }
    return count
}