/**
 * Zoologist code to find the common traits between two animals.
 *
 * @param animal1 A list representing the traits of animal1
 * @param animal2 A list representing the traits of animal2
 * @return A list of common traits between the two animals
 */
fun findCommonTraits(animal1: List<String>, animal2: List<String>): List<String> {

    if (animal1 !is List<*> || animal2 !is List<*>) {
        return listOf("Arguments must be lists.")
    }

    val commonTraits = mutableListOf<String>()

    if (animal1.intersect(animal2).isNotEmpty()) {
        for (trait in animal1) {
            if (trait in animal2) {
                commonTraits.add(trait)
            }
        }
    } else {
        return listOf("There are no common traits between the two animals.")
    }

    return commonTraits
}
/**
 * Zoologist code to find the common traits between two animals.
 *
 * @param animal1 A list representing the traits of animal1
 * @param animal2 A list representing the traits of animal2
 * @return A list of common traits between the two animals
 */
fun findCommonTraits(animal1: List<String>, animal2: List<String>): List<String> {
/**
 * Zoologist code to find the common traits between two animals.
 *
 * @param animal1 A list representing the traits of animal1
 * @param animal2 A list representing the traits of animal2
 * @return A list of common traits between the two animals
 */
fun findCommonTraits(animal1: List<String>, animal2: List<String>): List<String> {

    if (animal1 !is List<*> || animal2 !is List<*>) {
        return listOf("Arguments must be lists.")
    }

    val commonTraits = mutableListOf<String>()

    if (animal1.intersect(animal2).isNotEmpty()) {
        for (trait in animal1) {
            if (trait in animal2) {
                commonTraits.add(trait)
            }
        }
    } else {
        return listOf("There are no common traits between the two animals.")
    }

    return commonTraits
}