/**
 * Given a nested dictionary of veterinarians with their specialties,
 * return the specialty of a specific veterinarian based on name and species.
 *
 * @param vets A nested dictionary of veterinarians and their specialties.
 * @param name The name of the veterinarian.
 * @param species The species the veterinarian specializes in.
 * @return The specialty of the veterinarian for the given species.
 */
fun findVetSpecialty(vets: Map<String, List<String>>, name: String, species: String): String {

    var specialty = ""

    // Iterate over each veterinarian
    for ((vetName, vetInfo) in vets) {
        // Check if the veterinarian name matches the given name
        if (name.toLowerCase() == vetName.toLowerCase()) {
            // Iterate over each specialty of the veterinarian
            for (spec in vetInfo) {
                // Check if the veterinarian specializes in the given species
                if (spec.toLowerCase() == species.toLowerCase()) {
                    specialty = spec.capitalize()
                    break
                }
            }
        }
    }

    return specialty
}

// Dictionary of veterinarians and their specialties
val veterinarians = mapOf(
    "Dr. Smith" to listOf("Dog", "Cat"),
    "Dr. Johnson" to listOf("Bird", "Rabbit")
)
/**
 * Given a nested dictionary of veterinarians with their specialties,
 * return the specialty of a specific veterinarian based on name and species.
 *
 * @param vets A nested dictionary of veterinarians and their specialties.
 * @param name The name of the veterinarian.
 * @param species The species the veterinarian specializes in.
 * @return The specialty of the veterinarian for the given species.
 */
fun findVetSpecialty(vets: Map<String, List<String>>, name: String, species: String): String {
/**
 * Given a nested dictionary of veterinarians with their specialties,
 * return the specialty of a specific veterinarian based on name and species.
 *
 * @param vets A nested dictionary of veterinarians and their specialties.
 * @param name The name of the veterinarian.
 * @param species The species the veterinarian specializes in.
 * @return The specialty of the veterinarian for the given species.
 */
fun findVetSpecialty(vets: Map<String, List<String>>, name: String, species: String): String {

    var specialty = ""

    // Iterate over each veterinarian
    for ((vetName, vetInfo) in vets) {
        // Check if the veterinarian name matches the given name
        if (name.toLowerCase() == vetName.toLowerCase()) {
            // Iterate over each specialty of the veterinarian
            for (spec in vetInfo) {
                // Check if the veterinarian specializes in the given species
                if (spec.toLowerCase() == species.toLowerCase()) {
                    specialty = spec.capitalize()
                    break
                }
            }
        }
    }

    return specialty
}

// Dictionary of veterinarians and their specialties
val veterinarians = mapOf(
    "Dr. Smith" to listOf("Dog", "Cat"),
    "Dr. Johnson" to listOf("Bird", "Rabbit")
)