/**
 * Given two sets, return a new set containing only the elements that are common to both sets.
 *
 * @param set1 the first set
 * @param set2 the second set
 * @return A set containing the common elements found in both sets.
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Iterate through the elements in the first set
    for (element in set1) {
        // Check if the element is also present in the second set
        if (element in set2) {
            // Add the element to the common elements set
            commonElements.add(element)
        }
        // If the commonElements set has at least 5 elements, exit the loop early
        if (commonElements.size >= 5) {
            break
        }
    }

    return commonElements
}
/**
 * Given two sets, return a new set containing only the elements that are common to both sets.
 *
 * @param set1 the first set
 * @param set2 the second set
 * @return A set containing the common elements found in both sets.
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * Given two sets, return a new set containing only the elements that are common to both sets.
 *
 * @param set1 the first set
 * @param set2 the second set
 * @return A set containing the common elements found in both sets.
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Iterate through the elements in the first set
    for (element in set1) {
        // Check if the element is also present in the second set
        if (element in set2) {
            // Add the element to the common elements set
            commonElements.add(element)
        }
        // If the commonElements set has at least 5 elements, exit the loop early
        if (commonElements.size >= 5) {
            break
        }
    }

    return commonElements
}