/**
 * Given two lists, find all common elements between them.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements found.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, "apple", "banana", "cherry")
 * val list2 = listOf(3, 4, "banana", "kiwi", "mango")
 * println(findCommonElements(list1, list2)) // Output: [3, "banana"]
 * '``
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over each element in list1
    for (element in list1) {
        // Check if the element is present in list2
        if (element in list2) {
            // Add the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two lists, find all common elements between them.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements found.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, "apple", "banana", "cherry")
 * val list2 = listOf(3, 4, "banana", "kiwi", "mango")
 * println(findCommonElements(list1, list2)) // Output: [3, "banana"]
 * '``
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, find all common elements between them.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements found.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, "apple", "banana", "cherry")
 * val list2 = listOf(3, 4, "banana", "kiwi", "mango")
 * println(findCommonElements(list1, list2)) // Output: [3, "banana"]
 * '``
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over each element in list1
    for (element in list1) {
        // Check if the element is present in list2
        if (element in list2) {
            // Add the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}