/**
 * This function takes in two lists and returns the common elements between them using slicing.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val result = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element exists in list2 using slicing
        if (element in list2) {
            // If the element exists, append it to the result list
            result.add(element)
        }
    }

    // Return the resulting list
    return result
}
/**
 * This function takes in two lists and returns the common elements between them using slicing.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function takes in two lists and returns the common elements between them using slicing.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    // Initialize an empty list to store the common elements
    val result = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element exists in list2 using slicing
        if (element in list2) {
            // If the element exists, append it to the result list
            result.add(element)
        }
    }

    // Return the resulting list
    return result
}