/**
 * Given two lists, find the elements that are common to both lists and return them as a new list.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the elements that are common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is also in list2
        if (element in list2) {
            // Add the element to the common elements list
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two lists, find the elements that are common to both lists and return them as a new list.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the elements that are common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, find the elements that are common to both lists and return them as a new list.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the elements that are common to both list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is also in list2
        if (element in list2) {
            // Add the element to the common elements list
            commonElements.add(element)
        }
    }

    return commonElements
}