/**
 * A zoologist wants to count the number of animals in a zoo.
 * Given a map where the keys represent the different species of animals
 * and the values represent the number of animals of each species, write a function
 * that returns the total count of animals in the zoo.
 *
 * @param zoo A map representing the zoo with species as keys and number of animals as values.
 * @return The total count of animals in the zoo.
 * @throws IllegalArgumentException If the number of animals is less than 0.
 */
fun countAnimals(zoo: Map<String, Int>): Int {

    var totalCount = 0

    for ((_, count) in zoo) {
        if (count < 0) {
            throw IllegalArgumentException("The number of animals cannot be negative.")
        }
        totalCount += count
    }

    return totalCount
}
/**
 * A zoologist wants to count the number of animals in a zoo.
 * Given a map where the keys represent the different species of animals
 * and the values represent the number of animals of each species, write a function
 * that returns the total count of animals in the zoo.
 *
 * @param zoo A map representing the zoo with species as keys and number of animals as values.
 * @return The total count of animals in the zoo.
 * @throws IllegalArgumentException If the number of animals is less than 0.
 */
fun countAnimals(zoo: Map<String, Int>): Int {
/**
 * A zoologist wants to count the number of animals in a zoo.
 * Given a map where the keys represent the different species of animals
 * and the values represent the number of animals of each species, write a function
 * that returns the total count of animals in the zoo.
 *
 * @param zoo A map representing the zoo with species as keys and number of animals as values.
 * @return The total count of animals in the zoo.
 * @throws IllegalArgumentException If the number of animals is less than 0.
 */
fun countAnimals(zoo: Map<String, Int>): Int {

    var totalCount = 0

    for ((_, count) in zoo) {
        if (count < 0) {
            throw IllegalArgumentException("The number of animals cannot be negative.")
        }
        totalCount += count
    }

    return totalCount
}