/**
 * Returns the intersection of two sets and removes common elements from both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionAndRemoval(set1, set2)) // Output: [4, 5]
 * '``
 */
fun intersectionAndRemoval(set1: MutableSet<Int>, set2: MutableSet<Int>): MutableSet<Int> {

    // Find the intersection of the two sets
    val intersection = set1.intersect(set2).toMutableSet()

    // Remove the intersection elements from set1
    set1.removeAll(intersection)

    // Remove the intersection elements from set2
    set2.removeAll(intersection)

    return intersection
}
/**
 * Returns the intersection of two sets and removes common elements from both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionAndRemoval(set1, set2)) // Output: [4, 5]
 * '``
 */
fun intersectionAndRemoval(set1: MutableSet<Int>, set2: MutableSet<Int>): MutableSet<Int> {
/**
 * Returns the intersection of two sets and removes common elements from both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 *
 * Example:
 * '``
 * val set1 = setOf(1, 2, 3, 4, 5)
 * val set2 = setOf(4, 5, 6, 7, 8)
 * println(intersectionAndRemoval(set1, set2)) // Output: [4, 5]
 * '``
 */
fun intersectionAndRemoval(set1: MutableSet<Int>, set2: MutableSet<Int>): MutableSet<Int> {

    // Find the intersection of the two sets
    val intersection = set1.intersect(set2).toMutableSet()

    // Remove the intersection elements from set1
    set1.removeAll(intersection)

    // Remove the intersection elements from set2
    set2.removeAll(intersection)

    return intersection
}