/**
 * This function takes two lists as input and returns the number of common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the number of common elements between list1 and list2
 */
fun countCommonElements(list1: List<Any>, list2: List<Any>): Int {

    var count = 0

    // Make a copy of list1 and list2
    val list1Copy = list1.toMutableList()
    val list2Copy = list2.toMutableList()

    // Iterate over the elements in list1Copy
    for (element in list1Copy) {
        // Check if the element is present in list2Copy
        if (element in list2Copy) {
            count++
            // Remove the element from list2Copy to avoid double counting
            list2Copy.remove(element)
        }
    }

    return count
}
/**
 * This function takes two lists as input and returns the number of common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the number of common elements between list1 and list2
 */
fun countCommonElements(list1: List<Any>, list2: List<Any>): Int {
/**
 * This function takes two lists as input and returns the number of common elements between them.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the number of common elements between list1 and list2
 */
fun countCommonElements(list1: List<Any>, list2: List<Any>): Int {

    var count = 0

    // Make a copy of list1 and list2
    val list1Copy = list1.toMutableList()
    val list2Copy = list2.toMutableList()

    // Iterate over the elements in list1Copy
    for (element in list1Copy) {
        // Check if the element is present in list2Copy
        if (element in list2Copy) {
            count++
            // Remove the element from list2Copy to avoid double counting
            list2Copy.remove(element)
        }
    }

    return count
}