/**
 * Takes two lists as input and returns the common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return A list containing the common elements between list1 and list2, in the same order they appear in list1.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    if (list1.isEmpty() || list2.isEmpty()) {
        return emptyList()
    } else {
        val commonElements = mutableListOf<Any>()
        for (element in list1) {
            if (element in list2) {
                commonElements.add(element)
            }
        }
        return commonElements
    }
}
/**
 * Takes two lists as input and returns the common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return A list containing the common elements between list1 and list2, in the same order they appear in list1.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Takes two lists as input and returns the common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return A list containing the common elements between list1 and list2, in the same order they appear in list1.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    if (list1.isEmpty() || list2.isEmpty()) {
        return emptyList()
    } else {
        val commonElements = mutableListOf<Any>()
        for (element in list1) {
            if (element in list2) {
                commonElements.add(element)
            }
        }
        return commonElements
    }
}