/**
 * This function returns the intersection of two sets by removing elements that are not common to both sets.
 *
 * @param set1 First set.
 * @param set2 Second set.
 * @return Intersection set of the two input sets.
 */
fun intersectionSet(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Placeholder for the intersection set
    val intersection = mutableSetOf<Any>()

    // Loop through each element in set1
    for (element1 in set1) {
        // Loop through each element in set2
        for (element2 in set2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the intersection set
                intersection.add(element1)
                // Break inner loop to avoid redundant comparisons
                break
            }
        }
    }
    return intersection
}
/**
 * This function returns the intersection of two sets by removing elements that are not common to both sets.
 *
 * @param set1 First set.
 * @param set2 Second set.
 * @return Intersection set of the two input sets.
 */
fun intersectionSet(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function returns the intersection of two sets by removing elements that are not common to both sets.
 *
 * @param set1 First set.
 * @param set2 Second set.
 * @return Intersection set of the two input sets.
 */
fun intersectionSet(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Placeholder for the intersection set
    val intersection = mutableSetOf<Any>()

    // Loop through each element in set1
    for (element1 in set1) {
        // Loop through each element in set2
        for (element2 in set2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the intersection set
                intersection.add(element1)
                // Break inner loop to avoid redundant comparisons
                break
            }
        }
    }
    return intersection
}