/**
 * This function finds the common elements between two lists and returns them in a new list.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * findCommonElements(listOf("A", "B", "C"), listOf("C", "D", "E")) // ["C"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Write your code here to find the common elements between list1 and list2
    for (element in list1) {
        if (element in list2) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * This function finds the common elements between two lists and returns them in a new list.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * findCommonElements(listOf("A", "B", "C"), listOf("C", "D", "E")) // ["C"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function finds the common elements between two lists and returns them in a new list.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * findCommonElements(listOf("A", "B", "C"), listOf("C", "D", "E")) // ["C"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Write your code here to find the common elements between list1 and list2
    for (element in list1) {
        if (element in list2) {
            commonElements.add(element)
        }
    }

    return commonElements
}