/**
 * The purpose of this function is to subtract the common elements between two lists.
 *
 * @param list1 A list of integers
 * @param list2 A list of integers
 * @return A list containing the elements present in list1 but not in list2
 *
 * Example:
 * subtractCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) will return [1, 2, 3]
 */
fun subtractCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    // Find the common elements between the two lists
    val commonElements = list1.intersect(list2)

    // Subtract the common elements from list1
    val result = list1.toMutableList()
    result.removeAll(commonElements)

    return result
}
/**
 * The purpose of this function is to subtract the common elements between two lists.
 *
 * @param list1 A list of integers
 * @param list2 A list of integers
 * @return A list containing the elements present in list1 but not in list2
 *
 * Example:
 * subtractCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) will return [1, 2, 3]
 */
fun subtractCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * The purpose of this function is to subtract the common elements between two lists.
 *
 * @param list1 A list of integers
 * @param list2 A list of integers
 * @return A list containing the elements present in list1 but not in list2
 *
 * Example:
 * subtractCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) will return [1, 2, 3]
 */
fun subtractCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    // Find the common elements between the two lists
    val commonElements = list1.intersect(list2)

    // Subtract the common elements from list1
    val result = list1.toMutableList()
    result.removeAll(commonElements)

    return result
}