/**
 * This function takes in a dictionary of animals and their counts as input. It iterates over the dictionary and counts the total number of animals in the veterinarian's clinic. The function uses a while loop to iterate over the animal dictionary until all animals have been accounted for and returns the total count of animals.
 *
 * @param animalDict A dictionary containing animals names as keys and their respective counts as values.
 * @return Total count of animals in the veterinarian's clinic.
 */
fun countAnimals(animalDict: Map<String, Int>): Int {

    var totalCount = 0
    val remainingAnimals = animalDict.keys.toMutableList()

    while (remainingAnimals.isNotEmpty()) {
        val currentAnimal = remainingAnimals.removeAt(0)
        val animalCount = animalDict[currentAnimal] ?: 0
        totalCount += animalCount
    }

    return totalCount
}
/**
 * This function takes in a dictionary of animals and their counts as input. It iterates over the dictionary and counts the total number of animals in the veterinarian's clinic. The function uses a while loop to iterate over the animal dictionary until all animals have been accounted for and returns the total count of animals.
 *
 * @param animalDict A dictionary containing animals names as keys and their respective counts as values.
 * @return Total count of animals in the veterinarian's clinic.
 */
fun countAnimals(animalDict: Map<String, Int>): Int {
/**
 * This function takes in a dictionary of animals and their counts as input. It iterates over the dictionary and counts the total number of animals in the veterinarian's clinic. The function uses a while loop to iterate over the animal dictionary until all animals have been accounted for and returns the total count of animals.
 *
 * @param animalDict A dictionary containing animals names as keys and their respective counts as values.
 * @return Total count of animals in the veterinarian's clinic.
 */
fun countAnimals(animalDict: Map<String, Int>): Int {

    var totalCount = 0
    val remainingAnimals = animalDict.keys.toMutableList()

    while (remainingAnimals.isNotEmpty()) {
        val currentAnimal = remainingAnimals.removeAt(0)
        val animalCount = animalDict[currentAnimal] ?: 0
        totalCount += animalCount
    }

    return totalCount
}