/**
 * Given two sets, return a new set containing elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing common elements.
 *
 * Example:
 * findCommonSetElements(setOf(1, 2, 3), setOf(2, 3, 4)) // Output: setOf(2, 3)
 */
fun findCommonSetElements(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, return a new set containing elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing common elements.
 *
 * Example:
 * findCommonSetElements(setOf(1, 2, 3), setOf(2, 3, 4)) // Output: setOf(2, 3)
 */
fun findCommonSetElements(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * Given two sets, return a new set containing elements that are common to both sets.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A new set containing common elements.
 *
 * Example:
 * findCommonSetElements(setOf(1, 2, 3), setOf(2, 3, 4)) // Output: setOf(2, 3)
 */
fun findCommonSetElements(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
}