/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param list1 first list
 * @param list2 second list
 * @return commonElements list containing the common elements
 *
 * Examples:
 * checkCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 * checkCommonElements(listOf("a", "b", "c"), listOf("x", "y", "z")) -> []
 * checkCommonElements(listOf(7, 8, 9), listOf(7, 8, 9)) -> [7, 8, 9]
 * checkCommonElements(listOf("apple", "banana", "mango"), listOf("mango", "kiwi", "avocado")) -> ["mango"]
 */
fun checkCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the first list
    for (elem in list1) {
        // Check if the element is not in list2 using the '!' operator
        if (elem !in list2) {
            commonElements.add(elem)
        }
    }

    return commonElements
}
/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param list1 first list
 * @param list2 second list
 * @return commonElements list containing the common elements
 *
 * Examples:
 * checkCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 * checkCommonElements(listOf("a", "b", "c"), listOf("x", "y", "z")) -> []
 * checkCommonElements(listOf(7, 8, 9), listOf(7, 8, 9)) -> [7, 8, 9]
 * checkCommonElements(listOf("apple", "banana", "mango"), listOf("mango", "kiwi", "avocado")) -> ["mango"]
 */
fun checkCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param list1 first list
 * @param list2 second list
 * @return commonElements list containing the common elements
 *
 * Examples:
 * checkCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 * checkCommonElements(listOf("a", "b", "c"), listOf("x", "y", "z")) -> []
 * checkCommonElements(listOf(7, 8, 9), listOf(7, 8, 9)) -> [7, 8, 9]
 * checkCommonElements(listOf("apple", "banana", "mango"), listOf("mango", "kiwi", "avocado")) -> ["mango"]
 */
fun checkCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the first list
    for (elem in list1) {
        // Check if the element is not in list2 using the '!' operator
        if (elem !in list2) {
            commonElements.add(elem)
        }
    }

    return commonElements
}