/**
 * Given two lists of animals, this function returns a list of common species found in both lists.
 *
 * @param animals1 The first list of animals.
 * @param animals2 The second list of animals.
 * @return A list of common species found in both lists.
 */
fun findSpeciesInCommon(animals1: List<Map<String, String>>, animals2: List<Map<String, String>>): List<String> {

    val commonSpecies = mutableListOf<String>()

    for (animal1 in animals1) {
        for (animal2 in animals2) {
            if (animal1["species"] == animal2["species"]) {
                commonSpecies.add(animal1["species"]!!)
            }
        }
    }

    return commonSpecies
}
/**
 * Given two lists of animals, this function returns a list of common species found in both lists.
 *
 * @param animals1 The first list of animals.
 * @param animals2 The second list of animals.
 * @return A list of common species found in both lists.
 */
fun findSpeciesInCommon(animals1: List<Map<String, String>>, animals2: List<Map<String, String>>): List<String> {
/**
 * Given two lists of animals, this function returns a list of common species found in both lists.
 *
 * @param animals1 The first list of animals.
 * @param animals2 The second list of animals.
 * @return A list of common species found in both lists.
 */
fun findSpeciesInCommon(animals1: List<Map<String, String>>, animals2: List<Map<String, String>>): List<String> {

    val commonSpecies = mutableListOf<String>()

    for (animal1 in animals1) {
        for (animal2 in animals2) {
            if (animal1["species"] == animal2["species"]) {
                commonSpecies.add(animal1["species"]!!)
            }
        }
    }

    return commonSpecies
}