/**
 * This exercise requires finding the intersection of two sets and providing examples.
 *
 * @param set1 First set of items.
 * @param set2 Second set of items.
 * @return Intersection of set1 and set2.
 */
fun setExampleIntersection(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Check if either set is empty
    if (set1.isEmpty() || set2.isEmpty()) {
        return setOf("At least one set is empty. Cannot compute intersection.")
    }

    // Find the intersection using set intersection operation
    val intersection = set1.intersect(set2)

    // Check if intersection is empty
    if (intersection.isEmpty()) {
        return setOf("No items found in the intersection.")
    }

    // Provide examples of items in the intersection
    val examples = intersection.map { item ->
        when (item) {
            is String -> "A $item is in the intersection."
            is Int -> "The number $item is in the intersection."
            is Double -> "The value $item is in the intersection."
            is Map<*, *> -> {
                val keys = item.keys.joinToString(", ")
                "A dictionary with the following keys is in the intersection: $keys"
            }
            else -> "An item of unknown type is in the intersection."
        }
    }

    return examples.toSet()
}
/**
 * This exercise requires finding the intersection of two sets and providing examples.
 *
 * @param set1 First set of items.
 * @param set2 Second set of items.
 * @return Intersection of set1 and set2.
 */
fun setExampleIntersection(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This exercise requires finding the intersection of two sets and providing examples.
 *
 * @param set1 First set of items.
 * @param set2 Second set of items.
 * @return Intersection of set1 and set2.
 */
fun setExampleIntersection(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Check if either set is empty
    if (set1.isEmpty() || set2.isEmpty()) {
        return setOf("At least one set is empty. Cannot compute intersection.")
    }

    // Find the intersection using set intersection operation
    val intersection = set1.intersect(set2)

    // Check if intersection is empty
    if (intersection.isEmpty()) {
        return setOf("No items found in the intersection.")
    }

    // Provide examples of items in the intersection
    val examples = intersection.map { item ->
        when (item) {
            is String -> "A $item is in the intersection."
            is Int -> "The number $item is in the intersection."
            is Double -> "The value $item is in the intersection."
            is Map<*, *> -> {
                val keys = item.keys.joinToString(", ")
                "A dictionary with the following keys is in the intersection: $keys"
            }
            else -> "An item of unknown type is in the intersection."
        }
    }

    return examples.toSet()
}