/**
 * Given two sets, return a new set that contains the elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the shared elements.
 *
 * Example:
 * findSharedElements(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun findSharedElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val intersection = mutableSetOf<Int>()

    for (element in set1) {
        for (item in set2) {
            if (element == item) {
                intersection.add(element)
                break
            }
        }
    }

    return intersection
}
/**
 * Given two sets, return a new set that contains the elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the shared elements.
 *
 * Example:
 * findSharedElements(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun findSharedElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * Given two sets, return a new set that contains the elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the shared elements.
 *
 * Example:
 * findSharedElements(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)) // Output: setOf(3, 4)
 */
fun findSharedElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val intersection = mutableSetOf<Int>()

    for (element in set1) {
        for (item in set2) {
            if (element == item) {
                intersection.add(element)
                break
            }
        }
    }

    return intersection
}