/**
 * Given a set of elements and a list of elements, remove all elements from the set that are also in the list.
 * For elements in the list that are not in the set, append 'modified' before the element in the list.
 *
 * @param elementsSet A set of elements.
 * @param elementsList A list of elements.
 * @throws NotImplementedError If the elementsSet is not a set or elementsList is not a list.
 */
fun removeElementsAndModifyList(elementsSet: MutableSet<String>, elementsList: MutableList<String>) {

    if (elementsSet !is MutableSet<*>) {
        throw NotImplementedError("Argument 'elementsSet' must be a set.")
    }
    if (elementsList !is MutableList<*>) {
        throw NotImplementedError("Argument 'elementsList' must be a list.")
    }

    val commonElements = elementsSet.intersect(elementsList).toList()
    elementsSet.removeAll(commonElements)
    val elementsListModified = mutableListOf<String>()

    for (element in elementsList) {
        if (element !in elementsSet) {
            elementsListModified.add("modified $element")
        } else {
            elementsListModified.add(element)
        }
    }

    println("Elements set after removing elements: $elementsSet")
    println("Elements list after modifications: $elementsListModified")
}
/**
 * Given a set of elements and a list of elements, remove all elements from the set that are also in the list.
 * For elements in the list that are not in the set, append 'modified' before the element in the list.
 *
 * @param elementsSet A set of elements.
 * @param elementsList A list of elements.
 * @throws NotImplementedError If the elementsSet is not a set or elementsList is not a list.
 */
fun removeElementsAndModifyList(elementsSet: MutableSet<String>, elementsList: MutableList<String>) {
/**
 * Given a set of elements and a list of elements, remove all elements from the set that are also in the list.
 * For elements in the list that are not in the set, append 'modified' before the element in the list.
 *
 * @param elementsSet A set of elements.
 * @param elementsList A list of elements.
 * @throws NotImplementedError If the elementsSet is not a set or elementsList is not a list.
 */
fun removeElementsAndModifyList(elementsSet: MutableSet<String>, elementsList: MutableList<String>) {

    if (elementsSet !is MutableSet<*>) {
        throw NotImplementedError("Argument 'elementsSet' must be a set.")
    }
    if (elementsList !is MutableList<*>) {
        throw NotImplementedError("Argument 'elementsList' must be a list.")
    }

    val commonElements = elementsSet.intersect(elementsList).toList()
    elementsSet.removeAll(commonElements)
    val elementsListModified = mutableListOf<String>()

    for (element in elementsList) {
        if (element !in elementsSet) {
            elementsListModified.add("modified $element")
        } else {
            elementsListModified.add(element)
        }
    }

    println("Elements set after removing elements: $elementsSet")
    println("Elements list after modifications: $elementsListModified")
}