/**
 * This function takes two lists as input and returns the length of their intersection.
 *
 * @param list1 First input list.
 * @param list2 Second input list.
 * @return The length of the intersection between the two lists.
 */
fun intersectionLength(list1: List<Any>, list2: List<Any>): Int {

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

    // Create a copy of list2
    val list2Copy = list2.toMutableList()

    // Iterate through each element in list1
    for (elem in list1) {
        // Check if the element is present in list2Copy
        if (elem in list2Copy) {
            intersection.add(elem)
            list2Copy.remove(elem)
        }
    }

    return intersection.size
}
/**
 * This function takes two lists as input and returns the length of their intersection.
 *
 * @param list1 First input list.
 * @param list2 Second input list.
 * @return The length of the intersection between the two lists.
 */
fun intersectionLength(list1: List<Any>, list2: List<Any>): Int {
/**
 * This function takes two lists as input and returns the length of their intersection.
 *
 * @param list1 First input list.
 * @param list2 Second input list.
 * @return The length of the intersection between the two lists.
 */
fun intersectionLength(list1: List<Any>, list2: List<Any>): Int {

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

    // Create a copy of list2
    val list2Copy = list2.toMutableList()

    // Iterate through each element in list1
    for (elem in list1) {
        // Check if the element is present in list2Copy
        if (elem in list2Copy) {
            intersection.add(elem)
            list2Copy.remove(elem)
        }
    }

    return intersection.size
}