/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param lst1 The first input list.
 * @param lst2 The second input list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) returns [4, 5]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "pear")) returns ["banana"]
 */
fun findCommonElements(lst1: List<Any>, lst2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()
    for (element in lst1) {
        if (element in lst2) {
            commonElements.add(element)
        }
    }
    return commonElements
}

val lst1 = listOf(4, 5, 6, 7, 8)
val lst2 = listOf(5, 6, 7, 8, 9)

// Use the findCommonElements function to find the common elements between lst1 and lst2
val commonElements = findCommonElements(lst1, lst2)
/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param lst1 The first input list.
 * @param lst2 The second input list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) returns [4, 5]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "pear")) returns ["banana"]
 */
fun findCommonElements(lst1: List<Any>, lst2: List<Any>): List<Any> {
/**
 * Given two lists, return a new list containing the common elements between them.
 *
 * @param lst1 The first input list.
 * @param lst2 The second input list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) returns [4, 5]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "pear")) returns ["banana"]
 */
fun findCommonElements(lst1: List<Any>, lst2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()
    for (element in lst1) {
        if (element in lst2) {
            commonElements.add(element)
        }
    }
    return commonElements
}

val lst1 = listOf(4, 5, 6, 7, 8)
val lst2 = listOf(5, 6, 7, 8, 9)

// Use the findCommonElements function to find the common elements between lst1 and lst2
val commonElements = findCommonElements(lst1, lst2)