/**
 * This function takes a list of sets as input and returns a new set containing the common elements
 * found in all sets.
 *
 * @param list_of_sets A list of sets where each set represents a group of elements.
 * @return A set containing the common elements found in all sets.
 */
fun findCommonElements(listOfSets: List<Set<Any>>): Set<Any> {

    // Initialize the common elements set with the first set in the list
    var commonElements = HashSet(listOfSets[0])

    // Iterate through each set in the list starting from the second set
    for (set_ in listOfSets.subList(1, listOfSets.size)) {
        // Create a temporary set to store the common elements between the current set and the common elements set
        val tempSet = HashSet<Any>()

        // Iterate through each element in the common elements set
        for (element in commonElements) {
            // Check if the element is present in the current set
            if (element in set_) {
                // If it is, add it to the temporary set
                tempSet.add(element)
            }
        }

        // Update the common elements set with the temporary set
        commonElements = tempSet
    }

    return commonElements
}
/**
 * This function takes a list of sets as input and returns a new set containing the common elements
 * found in all sets.
 *
 * @param list_of_sets A list of sets where each set represents a group of elements.
 * @return A set containing the common elements found in all sets.
 */
fun findCommonElements(listOfSets: List<Set<Any>>): Set<Any> {
/**
 * This function takes a list of sets as input and returns a new set containing the common elements
 * found in all sets.
 *
 * @param list_of_sets A list of sets where each set represents a group of elements.
 * @return A set containing the common elements found in all sets.
 */
fun findCommonElements(listOfSets: List<Set<Any>>): Set<Any> {

    // Initialize the common elements set with the first set in the list
    var commonElements = HashSet(listOfSets[0])

    // Iterate through each set in the list starting from the second set
    for (set_ in listOfSets.subList(1, listOfSets.size)) {
        // Create a temporary set to store the common elements between the current set and the common elements set
        val tempSet = HashSet<Any>()

        // Iterate through each element in the common elements set
        for (element in commonElements) {
            // Check if the element is present in the current set
            if (element in set_) {
                // If it is, add it to the temporary set
                tempSet.add(element)
            }
        }

        // Update the common elements set with the temporary set
        commonElements = tempSet
    }

    return commonElements
}