/**
 * This function takes two initial lists as input and returns a new list containing the elements
 * that are common to both lists.
 *
 * @param initialList1 The first initial list.
 * @param initialList2 The second initial list.
 * @return A new list containing the common elements.
 *
 * Example:
 * createListIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * createListIntersection(listOf("a", "b", "c"), listOf("b", "c", "d")) // ["b", "c"]
 */
fun createListIntersection(initialList1: List<Any>, initialList2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()
    for (element in initialList1) {
        if (element in initialList2) {
            commonElements.add(element)
        }
    }
    return commonElements
}
/**
 * This function takes two initial lists as input and returns a new list containing the elements
 * that are common to both lists.
 *
 * @param initialList1 The first initial list.
 * @param initialList2 The second initial list.
 * @return A new list containing the common elements.
 *
 * Example:
 * createListIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * createListIntersection(listOf("a", "b", "c"), listOf("b", "c", "d")) // ["b", "c"]
 */
fun createListIntersection(initialList1: List<Any>, initialList2: List<Any>): List<Any> {
/**
 * This function takes two initial lists as input and returns a new list containing the elements
 * that are common to both lists.
 *
 * @param initialList1 The first initial list.
 * @param initialList2 The second initial list.
 * @return A new list containing the common elements.
 *
 * Example:
 * createListIntersection(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * createListIntersection(listOf("a", "b", "c"), listOf("b", "c", "d")) // ["b", "c"]
 */
fun createListIntersection(initialList1: List<Any>, initialList2: List<Any>): List<Any> {

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