/**
 * In this exercise, you need to complete the code to find the common elements between two sets using nested while loops.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements between 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

    // Use nested while loops to iterate through each element in set1
    for (element1 in set1) {
        for (element2 in set2) {
            // Check if the current element in set1 exists in set2
            if (element1 == element2) {
                commonElements.add(element1) // Add the common element to the set
                break // Exit the inner loop once a common element is found
            }
        }
    }

    return commonElements
}
/**
 * In this exercise, you need to complete the code to find the common elements between two sets using nested while loops.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements between set1 and set2.
 */
fun getCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * In this exercise, you need to complete the code to find the common elements between two sets using nested while loops.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A set containing the common elements between 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

    // Use nested while loops to iterate through each element in set1
    for (element1 in set1) {
        for (element2 in set2) {
            // Check if the current element in set1 exists in set2
            if (element1 == element2) {
                commonElements.add(element1) // Add the common element to the set
                break // Exit the inner loop once a common element is found
            }
        }
    }

    return commonElements
}