/**
 * Given two lists, delete the common elements from both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A pair containing the modified lists where common elements are removed.
 */
fun deleteCommonElements(list1: MutableList<Int>, list2: MutableList<Int>): Pair<List<Int>, List<Int>> {

    // Find the common elements between list1 and list2
    val commonElements = list1.filter { it in list2 }

    // Remove the common elements from both lists
    commonElements.forEach { element ->
        while (element in list1) {
            list1.remove(element)
        }
        while (element in list2) {
            list2.remove(element)
        }
    }

    return Pair(list1, list2)
}

// Example usage
/**
 * Given two lists, delete the common elements from both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A pair containing the modified lists where common elements are removed.
 */
fun deleteCommonElements(list1: MutableList<Int>, list2: MutableList<Int>): Pair<List<Int>, List<Int>> {
/**
 * Given two lists, delete the common elements from both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A pair containing the modified lists where common elements are removed.
 */
fun deleteCommonElements(list1: MutableList<Int>, list2: MutableList<Int>): Pair<List<Int>, List<Int>> {

    // Find the common elements between list1 and list2
    val commonElements = list1.filter { it in list2 }

    // Remove the common elements from both lists
    commonElements.forEach { element ->
        while (element in list1) {
            list1.remove(element)
        }
        while (element in list2) {
            list2.remove(element)
        }
    }

    return Pair(list1, list2)
}

// Example usage