/**
 * Given a dictionary of veterinary records, find the negative index of the animal's name.
 *
 * @param vetRecords A dictionary containing the animal name as the key and the number of visits as the value.
 * @return The negative index of the animal's name.
 */
fun findNegativeIndex(vetRecords: Map<String, Int>): Int {

    val animalNames = vetRecords.keys.toList()
    // Loop through the dictionary to find the animal with the maximum number of visits
    var maxVisits = 0
    for (animalName in vetRecords.keys) {
        val visits = vetRecords[animalName] ?: 0
        if (visits > maxVisits) {
            maxVisits = visits
        }
    }

    // Find the negative index of the animal with maximum visits
    for (i in animalNames.indices) {
        if (vetRecords[animalNames[i]] == maxVisits) {
            return -1 * (animalNames.size - i - 1)
        }
    }
    return 0
}
/**
 * Given a dictionary of veterinary records, find the negative index of the animal's name.
 *
 * @param vetRecords A dictionary containing the animal name as the key and the number of visits as the value.
 * @return The negative index of the animal's name.
 */
fun findNegativeIndex(vetRecords: Map<String, Int>): Int {
/**
 * Given a dictionary of veterinary records, find the negative index of the animal's name.
 *
 * @param vetRecords A dictionary containing the animal name as the key and the number of visits as the value.
 * @return The negative index of the animal's name.
 */
fun findNegativeIndex(vetRecords: Map<String, Int>): Int {

    val animalNames = vetRecords.keys.toList()
    // Loop through the dictionary to find the animal with the maximum number of visits
    var maxVisits = 0
    for (animalName in vetRecords.keys) {
        val visits = vetRecords[animalName] ?: 0
        if (visits > maxVisits) {
            maxVisits = visits
        }
    }

    // Find the negative index of the animal with maximum visits
    for (i in animalNames.indices) {
        if (vetRecords[animalNames[i]] == maxVisits) {
            return -1 * (animalNames.size - i - 1)
        }
    }
    return 0
}