/**
 * This function takes in two sets as input and returns a set containing all the common elements between them.
 *
 * @param set1 First set
 * @param set2 Second set
 * @return Set of common elements between set1 and set2
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Infinite while loop until the user breaks it
    while (true) {
        // Get an element from set1
        for (element in set1) {
            // Check if the element is present in set2
            if (element in set2) {
                // Add the common element to the commonElements set
                commonElements.add(element)
            }
        }

        // Check if there are no common elements
        if (commonElements.isEmpty()) {
            // Print a message notifying the user about no common elements
            println("There are no common elements between the sets.")
        } else {
            // Print the common elements
            println("The common elements between the sets are: $commonElements.")
        }

        // Ask the user if they want to continue finding common elements
        print("Do you want to find common elements between the sets? (yes/no): ")
        val choice = readLine()
        if (choice?.toLowerCase() != "yes") {
            break
        }
    }

    return commonElements
}
/**
 * This function takes in two sets as input and returns a set containing all the common elements between them.
 *
 * @param set1 First set
 * @param set2 Second set
 * @return Set of common elements between set1 and set2
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function takes in two sets as input and returns a set containing all the common elements between them.
 *
 * @param set1 First set
 * @param set2 Second set
 * @return Set of common elements between set1 and set2
 */
fun findCommonElements(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Infinite while loop until the user breaks it
    while (true) {
        // Get an element from set1
        for (element in set1) {
            // Check if the element is present in set2
            if (element in set2) {
                // Add the common element to the commonElements set
                commonElements.add(element)
            }
        }

        // Check if there are no common elements
        if (commonElements.isEmpty()) {
            // Print a message notifying the user about no common elements
            println("There are no common elements between the sets.")
        } else {
            // Print the common elements
            println("The common elements between the sets are: $commonElements.")
        }

        // Ask the user if they want to continue finding common elements
        print("Do you want to find common elements between the sets? (yes/no): ")
        val choice = readLine()
        if (choice?.toLowerCase() != "yes") {
            break
        }
    }

    return commonElements
}