/**
 * Write a function that takes two lists as input and returns a new list containing only the common elements.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return A list containing the common elements between 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>()

    // Loop through each element in list1
    for (elem1 in list1) {
        // Set a boolean variable to False
        var found = false

        // Loop through each element in list2
        for (elem2 in list2) {
            // Check if the current element in list1 is equal to the current element in list2
            if (elem1 == elem2) {
                // Update the boolean variable to True
                found = true
            }
        }

        // Check if the element from list1 was found in list2
        if (found) {
            // Append the common element to the commonElements list
            commonElements.add(elem1)
        }
    }

    return commonElements
}
/**
 * Write a function that takes two lists as input and returns a new list containing only the common elements.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return A list containing the common elements between list1 and list2
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Write a function that takes two lists as input and returns a new list containing only the common elements.
 *
 * @param list1 First list
 * @param list2 Second list
 * @return A list containing the common elements between 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>()

    // Loop through each element in list1
    for (elem1 in list1) {
        // Set a boolean variable to False
        var found = false

        // Loop through each element in list2
        for (elem2 in list2) {
            // Check if the current element in list1 is equal to the current element in list2
            if (elem1 == elem2) {
                // Update the boolean variable to True
                found = true
            }
        }

        // Check if the element from list1 was found in list2
        if (found) {
            // Append the common element to the commonElements list
            commonElements.add(elem1)
        }
    }

    return commonElements
}