/**
 * Returns the intersection of two lists,
 * excluding any occurrences that exist in both but not in either.
 *
 * @param data1 a list of elements
 * @param data2 a list of elements
 * @return a list of elements that exist in both data1 and data2,
 * excluding any elements that exist in both but not in either.
 */
fun intersectionExercise(data1: List<Any>, data2: List<Any>): List<Any> {

    // Find the intersection of data1 and data2
    val intersection = data1.filter { it in data2 }

    // Exclude elements that exist in both but not in either
    val result = intersection.filter { element ->
        element !in (data1 - data2) && element !in (data2 - data1)
    }

    return result
}
/**
 * Returns the intersection of two lists,
 * excluding any occurrences that exist in both but not in either.
 *
 * @param data1 a list of elements
 * @param data2 a list of elements
 * @return a list of elements that exist in both data1 and data2,
 * excluding any elements that exist in both but not in either.
 */
fun intersectionExercise(data1: List<Any>, data2: List<Any>): List<Any> {
/**
 * Returns the intersection of two lists,
 * excluding any occurrences that exist in both but not in either.
 *
 * @param data1 a list of elements
 * @param data2 a list of elements
 * @return a list of elements that exist in both data1 and data2,
 * excluding any elements that exist in both but not in either.
 */
fun intersectionExercise(data1: List<Any>, data2: List<Any>): List<Any> {

    // Find the intersection of data1 and data2
    val intersection = data1.filter { it in data2 }

    // Exclude elements that exist in both but not in either
    val result = intersection.filter { element ->
        element !in (data1 - data2) && element !in (data2 - data1)
    }

    return result
}