/**
 * Given two lists, count the number of elements that appear in both lists.
 *
 * @param listA The first list of elements
 * @param listB The second list of elements
 * @return The number of elements that appear in both lists
 */
fun countSameElements(listA: List<Any>, listB: List<Any>): Int {

    var count = 0
    var indexA = 0

    while (indexA < listA.size) {
        val elementA = listA[indexA]
        var indexB = 0

        while (indexB < listB.size) {
            val elementB = listB[indexB]
            indexB++

            if (elementA == elementB) {
                count++
            }
        }

        indexA++
    }

    return count
}
/**
 * Given two lists, count the number of elements that appear in both lists.
 *
 * @param listA The first list of elements
 * @param listB The second list of elements
 * @return The number of elements that appear in both lists
 */
fun countSameElements(listA: List<Any>, listB: List<Any>): Int {
/**
 * Given two lists, count the number of elements that appear in both lists.
 *
 * @param listA The first list of elements
 * @param listB The second list of elements
 * @return The number of elements that appear in both lists
 */
fun countSameElements(listA: List<Any>, listB: List<Any>): Int {

    var count = 0
    var indexA = 0

    while (indexA < listA.size) {
        val elementA = listA[indexA]
        var indexB = 0

        while (indexB < listB.size) {
            val elementB = listB[indexB]
            indexB++

            if (elementA == elementB) {
                count++
            }
        }

        indexA++
    }

    return count
}