/**
 * Given two lists, find the common elements that exist in both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements found in both lists.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "grape", "kiwi")) // ["banana"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element in list1) {
        if (element !in list2) {
            continue
        }
        commonElements.add(element)
    }

    return commonElements
}
/**
 * Given two lists, find the common elements that exist in both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements found in both lists.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "grape", "kiwi")) // ["banana"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, find the common elements that exist in both lists.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A new list containing the common elements found in both lists.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * findCommonElements(listOf("apple", "banana", "orange"), listOf("banana", "grape", "kiwi")) // ["banana"]
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    for (element in list1) {
        if (element !in list2) {
            continue
        }
        commonElements.add(element)
    }

    return commonElements
}