/**
 * Given three sets, return a list of elements that are common to all three sets
 *
 * @param set1 First set
 * @param set2 Second set
 * @param set3 Third set
 * @return List of common elements
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(2, 3, 4), setOf(3, 4, 5)) -> [3]
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>, set3: Set<Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Nested loops to iterate over the elements of each set
    for (element1 in set1) {
        for (element2 in set2) {
            for (element3 in set3) {
                if (element1 == element2 && element2 == element3) {
                    result.add(element1)  // Add the common element to the result list
                }
            }
        }
    }

    return result
}
/**
 * Given three sets, return a list of elements that are common to all three sets
 *
 * @param set1 First set
 * @param set2 Second set
 * @param set3 Third set
 * @return List of common elements
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(2, 3, 4), setOf(3, 4, 5)) -> [3]
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>, set3: Set<Int>): List<Int> {
/**
 * Given three sets, return a list of elements that are common to all three sets
 *
 * @param set1 First set
 * @param set2 Second set
 * @param set3 Third set
 * @return List of common elements
 *
 * Example:
 * findCommonElements(setOf(1, 2, 3), setOf(2, 3, 4), setOf(3, 4, 5)) -> [3]
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>, set3: Set<Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Nested loops to iterate over the elements of each set
    for (element1 in set1) {
        for (element2 in set2) {
            for (element3 in set3) {
                if (element1 == element2 && element2 == element3) {
                    result.add(element1)  // Add the common element to the result list
                }
            }
        }
    }

    return result
}