/**
 * Given a DNA sequence and a set of restriction sites, this function checks if any of the restriction sites
 * can be found in the DNA sequence. It returns the index where the first restriction site is found.
 *
 * @param sequence The DNA sequence to be checked.
 * @param restrictionSites A set of restriction site sequences.
 * @return The index where the first restriction site is found, or -1 if none is found.
 */
fun checkRestrictionSites(sequence: String, restrictionSites: Set<String>): Int {

    for (index in sequence.indices) {
        for (site in restrictionSites) {
            if ((index + site.length) > sequence.length) {
                // Need to break here as we reached the end of the sequence
                break
            }
            if (sequence.substring(index, index + site.length) == site) {
                return index
            }
        }
    }
    // No restriction site found
    return -1
}
/**
 * Given a DNA sequence and a set of restriction sites, this function checks if any of the restriction sites
 * can be found in the DNA sequence. It returns the index where the first restriction site is found.
 *
 * @param sequence The DNA sequence to be checked.
 * @param restrictionSites A set of restriction site sequences.
 * @return The index where the first restriction site is found, or -1 if none is found.
 */
fun checkRestrictionSites(sequence: String, restrictionSites: Set<String>): Int {
/**
 * Given a DNA sequence and a set of restriction sites, this function checks if any of the restriction sites
 * can be found in the DNA sequence. It returns the index where the first restriction site is found.
 *
 * @param sequence The DNA sequence to be checked.
 * @param restrictionSites A set of restriction site sequences.
 * @return The index where the first restriction site is found, or -1 if none is found.
 */
fun checkRestrictionSites(sequence: String, restrictionSites: Set<String>): Int {

    for (index in sequence.indices) {
        for (site in restrictionSites) {
            if ((index + site.length) > sequence.length) {
                // Need to break here as we reached the end of the sequence
                break
            }
            if (sequence.substring(index, index + site.length) == site) {
                return index
            }
        }
    }
    // No restriction site found
    return -1
}