/**
 * Given two sets, find the common elements using iteration and return them.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements of set1 and set2.
 */
fun getCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    val commonElements = mutableSetOf<Any>() // Initialize an empty set to store common elements

    for (element in set1) { // Iterate through the elements in set1
        if (element in set2) { // Check if the element is also in set2
            commonElements.add(element) // Add the common element to the set
        }
    }

    return commonElements
}
/**
 * Given two sets, find the common elements using iteration and return them.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements of set1 and set2.
 */
fun getCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * Given two sets, find the common elements using iteration and return them.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements of set1 and set2.
 */
fun getCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    val commonElements = mutableSetOf<Any>() // Initialize an empty set to store common elements

    for (element in set1) { // Iterate through the elements in set1
        if (element in set2) { // Check if the element is also in set2
            commonElements.add(element) // Add the common element to the set
        }
    }

    return commonElements
}