/**
 * This function takes in two lists and returns a list of common elements.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the elements common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element1 in list1) {
        var found = false

        for (element2 in list2) {
            if (element1 === element2) {  // Identity comparison
                found = true
                break
            }
        }

        if (found) {
            commonElements.add(element1)
        }
    }

    return commonElements
}
/**
 * This function takes in two lists and returns a list of common elements.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the elements common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function takes in two lists and returns a list of common elements.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the elements common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element1 in list1) {
        var found = false

        for (element2 in list2) {
            if (element1 === element2) {  // Identity comparison
                found = true
                break
            }
        }

        if (found) {
            commonElements.add(element1)
        }
    }

    return commonElements
}