/**
 * Given two lists, this function returns a new list containing the common elements between the two lists, while ignoring duplicates.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the elements in list1
    for (element1 in list1) {
        // Check if the element in list1 also exists in list2
        if (element1 in list2) {
            // Check if the element is not already in the commonElements list
            if (element1 !in commonElements) {
                // Add the element to the commonElements list
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}
/**
 * Given two lists, this function returns a new list containing the common elements between the two lists, while ignoring duplicates.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, this function returns a new list containing the common elements between the two lists, while ignoring duplicates.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the elements in list1
    for (element1 in list1) {
        // Check if the element in list1 also exists in list2
        if (element1 in list2) {
            // Check if the element is not already in the commonElements list
            if (element1 !in commonElements) {
                // Add the element to the commonElements list
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}