/**
 * This function takes in two sets, set1 and set2, and performs the following operations:
 * 1. Removes all elements from set1 that are also present in set2
 * 2. Multiplies each element in set1 by the product of set2
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Resultant set after removing elements and multiplying
 *
 * Example:
 * set1 = setOf(1, 2, 3, 4)
 * set2 = setOf(2, 4)
 *
 * The function will remove elements 2 and 4 from set1 and multiply each remaining element by 8 (product of set2).
 * The resultant set will be setOf(8, 24)
 */
fun setMultiplication(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val result = set1.toMutableSet()
    
    set2.forEach { element -> result.remove(element) }
    
    val product = set2.fold(1) { acc, element -> acc * element }
    
    return result.map { it * product }.toSet()
}
/**
 * This function takes in two sets, set1 and set2, and performs the following operations:
 * 1. Removes all elements from set1 that are also present in set2
 * 2. Multiplies each element in set1 by the product of set2
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Resultant set after removing elements and multiplying
 *
 * Example:
 * set1 = setOf(1, 2, 3, 4)
 * set2 = setOf(2, 4)
 *
 * The function will remove elements 2 and 4 from set1 and multiply each remaining element by 8 (product of set2).
 * The resultant set will be setOf(8, 24)
 */
fun setMultiplication(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * This function takes in two sets, set1 and set2, and performs the following operations:
 * 1. Removes all elements from set1 that are also present in set2
 * 2. Multiplies each element in set1 by the product of set2
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Resultant set after removing elements and multiplying
 *
 * Example:
 * set1 = setOf(1, 2, 3, 4)
 * set2 = setOf(2, 4)
 *
 * The function will remove elements 2 and 4 from set1 and multiply each remaining element by 8 (product of set2).
 * The resultant set will be setOf(8, 24)
 */
fun setMultiplication(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val result = set1.toMutableSet()
    
    set2.forEach { element -> result.remove(element) }
    
    val product = set2.fold(1) { acc, element -> acc * element }
    
    return result.map { it * product }.toSet()
}