/**
 * Given two sets, find the common elements between them and return them as a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the common elements between set1 and set2.
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(3, 4, 5)) -> setOf(3)
 * findCommonElements(setOf(1, 2, 3), setOf(4, 5, 6)) -> setOf()
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val commonElements = mutableSetOf<Int>()

    for (element in set1) {
        if (element in set2) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two sets, find the common elements between them and return them as a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the common elements between set1 and set2.
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(3, 4, 5)) -> setOf(3)
 * findCommonElements(setOf(1, 2, 3), setOf(4, 5, 6)) -> setOf()
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * Given two sets, find the common elements between them and return them as a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing the common elements between set1 and set2.
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(3, 4, 5)) -> setOf(3)
 * findCommonElements(setOf(1, 2, 3), setOf(4, 5, 6)) -> setOf()
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    val commonElements = mutableSetOf<Int>()

    for (element in set1) {
        if (element in set2) {
            commonElements.add(element)
        }
    }

    return commonElements
}