/**
 * This function takes two sets as input and returns their intersection using the AND operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * intersectionWithAndOperator(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionWithAndOperator(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    if (set1 !is Set<*> || set2 !is Set<*>) {
        throw IllegalArgumentException("Both inputs must be sets.")
    }

    // Find the intersection of set1 and set2 using the AND operator
    val intersection = set1.intersect(set2)

    return intersection
}
/**
 * This function takes two sets as input and returns their intersection using the AND operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * intersectionWithAndOperator(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionWithAndOperator(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * This function takes two sets as input and returns their intersection using the AND operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * intersectionWithAndOperator(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun intersectionWithAndOperator(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    if (set1 !is Set<*> || set2 !is Set<*>) {
        throw IllegalArgumentException("Both inputs must be sets.")
    }

    // Find the intersection of set1 and set2 using the AND operator
    val intersection = set1.intersect(set2)

    return intersection
}