/**
 * This function takes a list of animal species and a dictionary that contains
 * the count of each animal species seen in the wild by a zoologist. It returns
 * the total count of animals seen by the zoologist of the species present in the
 * given list.
 *
 * @param speciesList A list of animal species (strings)
 * @param animalDict A dictionary containing the count of each animal species (string) seen by the zoologist
 * @return Total count of animals seen by the zoologist of the given species in the list
 */
fun countAnimals(speciesList: List<String>, animalDict: Map<String, Int>): Int {

    var totalCount = 0
    for (species in speciesList) {
        if (species in animalDict) {
            totalCount += animalDict[species] ?: 0
        }
    }
    return totalCount
}

// Sample usage
/**
 * This function takes a list of animal species and a dictionary that contains
 * the count of each animal species seen in the wild by a zoologist. It returns
 * the total count of animals seen by the zoologist of the species present in the
 * given list.
 *
 * @param speciesList A list of animal species (strings)
 * @param animalDict A dictionary containing the count of each animal species (string) seen by the zoologist
 * @return Total count of animals seen by the zoologist of the given species in the list
 */
fun countAnimals(speciesList: List<String>, animalDict: Map<String, Int>): Int {
/**
 * This function takes a list of animal species and a dictionary that contains
 * the count of each animal species seen in the wild by a zoologist. It returns
 * the total count of animals seen by the zoologist of the species present in the
 * given list.
 *
 * @param speciesList A list of animal species (strings)
 * @param animalDict A dictionary containing the count of each animal species (string) seen by the zoologist
 * @return Total count of animals seen by the zoologist of the given species in the list
 */
fun countAnimals(speciesList: List<String>, animalDict: Map<String, Int>): Int {

    var totalCount = 0
    for (species in speciesList) {
        if (species in animalDict) {
            totalCount += animalDict[species] ?: 0
        }
    }
    return totalCount
}

// Sample usage