/**
 * This function takes two lists as input and deletes common elements from both lists.
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return The modified lists with common elements removed
 */
fun deleteCommonElements(list1: MutableList<Any>, list2: MutableList<Any>): Pair<MutableList<Any>, MutableList<Any>> {

    // Iterate over each element in list1
    val iterator1 = list1.iterator()
    while (iterator1.hasNext()) {
        val element = iterator1.next()
        // Check if the element is present in list2
        if (element in list2) {
            // Delete the common element from list1
            iterator1.remove()
        }
    }

    // Iterate over each element in list2
    val iterator2 = list2.iterator()
    while (iterator2.hasNext()) {
        val element = iterator2.next()
        // Check if the element is present in list1
        if (element in list1) {
            // Delete the common element from list2
            iterator2.remove()
        }
    }

    return Pair(list1, list2)
}
/**
 * This function takes two lists as input and deletes common elements from both lists.
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return The modified lists with common elements removed
 */
fun deleteCommonElements(list1: MutableList<Any>, list2: MutableList<Any>): Pair<MutableList<Any>, MutableList<Any>> {
/**
 * This function takes two lists as input and deletes common elements from both lists.
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return The modified lists with common elements removed
 */
fun deleteCommonElements(list1: MutableList<Any>, list2: MutableList<Any>): Pair<MutableList<Any>, MutableList<Any>> {

    // Iterate over each element in list1
    val iterator1 = list1.iterator()
    while (iterator1.hasNext()) {
        val element = iterator1.next()
        // Check if the element is present in list2
        if (element in list2) {
            // Delete the common element from list1
            iterator1.remove()
        }
    }

    // Iterate over each element in list2
    val iterator2 = list2.iterator()
    while (iterator2.hasNext()) {
        val element = iterator2.next()
        // Check if the element is present in list1
        if (element in list1) {
            // Delete the common element from list2
            iterator2.remove()
        }
    }

    return Pair(list1, list2)
}