/**
 * Given a list of animals and a name, return the number of animals whose names
 * start with the provided name.
 *
 * @param animalList A list of animal names (strings).
 * @param name The target name to match with the start of the animal names.
 * @return The number of animals whose names start with the provided name.
 *
 * Example:
 * animals = listOf("dog", "cat", "dolphin", "deer", "donkey", "duck")
 * getAnimalCount(animals, "d") // 4
 * getAnimalCount(animals, "do") // 2
 * getAnimalCount(animals, "dolph") // 1
 * getAnimalCount(animals, "a") // 0
 * getAnimalCount(animals, "c") // 1
 */
fun getAnimalCount(animalList: List<String>, name: String): Int {

    var count = 0
    for (animal in animalList) {
        if (animal.startsWith(name)) {
            count++
        }
    }
    return count
}
/**
 * Given a list of animals and a name, return the number of animals whose names
 * start with the provided name.
 *
 * @param animalList A list of animal names (strings).
 * @param name The target name to match with the start of the animal names.
 * @return The number of animals whose names start with the provided name.
 *
 * Example:
 * animals = listOf("dog", "cat", "dolphin", "deer", "donkey", "duck")
 * getAnimalCount(animals, "d") // 4
 * getAnimalCount(animals, "do") // 2
 * getAnimalCount(animals, "dolph") // 1
 * getAnimalCount(animals, "a") // 0
 * getAnimalCount(animals, "c") // 1
 */
fun getAnimalCount(animalList: List<String>, name: String): Int {
/**
 * Given a list of animals and a name, return the number of animals whose names
 * start with the provided name.
 *
 * @param animalList A list of animal names (strings).
 * @param name The target name to match with the start of the animal names.
 * @return The number of animals whose names start with the provided name.
 *
 * Example:
 * animals = listOf("dog", "cat", "dolphin", "deer", "donkey", "duck")
 * getAnimalCount(animals, "d") // 4
 * getAnimalCount(animals, "do") // 2
 * getAnimalCount(animals, "dolph") // 1
 * getAnimalCount(animals, "a") // 0
 * getAnimalCount(animals, "c") // 1
 */
fun getAnimalCount(animalList: List<String>, name: String): Int {

    var count = 0
    for (animal in animalList) {
        if (animal.startsWith(name)) {
            count++
        }
    }
    return count
}