/**
 * Given two sets, find the common elements 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.
 */
fun commonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Initialize an empty set
    val common = mutableSetOf<Any>()
    
    // Loop through each element in set1
    for (elem in set1) {
        // Check if the element is present in set2
        if (elem in set2) {
            // Add the common element to the new set
            common.add(elem)
        }
    }
    
    // Return the set of common elements
    return common
}
/**
 * Given two sets, find the common elements 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.
 */
fun commonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * Given two sets, find the common elements 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.
 */
fun commonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Initialize an empty set
    val common = mutableSetOf<Any>()
    
    // Loop through each element in set1
    for (elem in set1) {
        // Check if the element is present in set2
        if (elem in set2) {
            // Add the common element to the new set
            common.add(elem)
        }
    }
    
    // Return the set of common elements
    return common
}