/**
 * This function takes a set and a list of elements as arguments and appends the elements to the set if they are not already present.
 * The function returns the updated set.
 *
 * @param set1 The original set.
 * @param elementList The list of elements to be appended.
 * @return The updated set after appending the new elements.
 */
fun appendNewElementsToSet(set1: MutableSet<Any>, elementList: List<Any>): MutableSet<Any> {

    // Convert the list to a set to remove duplicates
    val elementSet = elementList.toSet()

    // Perform set intersection to find the common elements between set1 and elementSet
    val commonElements = set1.intersect(elementSet)

    // Check if any common elements exist
    if (commonElements.isNotEmpty()) {
        println("Common elements found between the original set and the new elements:")
        println(commonElements)
    } else {
        println("No common elements found between the original set and the new elements.")
    }

    // Remove the common elements from elementSet to avoid duplicates
    val newElements = elementSet - commonElements

    // Append the newElements to set1
    set1.addAll(newElements)

    return set1
}
/**
 * This function takes a set and a list of elements as arguments and appends the elements to the set if they are not already present.
 * The function returns the updated set.
 *
 * @param set1 The original set.
 * @param elementList The list of elements to be appended.
 * @return The updated set after appending the new elements.
 */
fun appendNewElementsToSet(set1: MutableSet<Any>, elementList: List<Any>): MutableSet<Any> {
/**
 * This function takes a set and a list of elements as arguments and appends the elements to the set if they are not already present.
 * The function returns the updated set.
 *
 * @param set1 The original set.
 * @param elementList The list of elements to be appended.
 * @return The updated set after appending the new elements.
 */
fun appendNewElementsToSet(set1: MutableSet<Any>, elementList: List<Any>): MutableSet<Any> {

    // Convert the list to a set to remove duplicates
    val elementSet = elementList.toSet()

    // Perform set intersection to find the common elements between set1 and elementSet
    val commonElements = set1.intersect(elementSet)

    // Check if any common elements exist
    if (commonElements.isNotEmpty()) {
        println("Common elements found between the original set and the new elements:")
        println(commonElements)
    } else {
        println("No common elements found between the original set and the new elements.")
    }

    // Remove the common elements from elementSet to avoid duplicates
    val newElements = elementSet - commonElements

    // Append the newElements to set1
    set1.addAll(newElements)

    return set1
}