/**
 * Given a dictionary of area data and a specific area code, 
 * this function returns the count of each species found in that area.
 * 
 * @param areaData A nested dictionary containing area data 
 * where the keys are area codes and values are dictionaries 
 * with species as keys and their count as values.
 * @param areaCode The specific area code for which the species count 
 * needs to be determined.
 * @return A dictionary containing the count of each species 
 * found in the specified area code.
 */
fun countSpeciesInArea(areaData: Map<String, Map<String, Int>>, areaCode: String): Map<String, Int> {

    if (areaCode in areaData) {
        val speciesCount = mutableMapOf<String, Int>()
        for ((species, count) in areaData[areaCode]!!) {
            speciesCount[species] = speciesCount.getOrDefault(species, 0) + count
        }
        return speciesCount
    } else {
        return mapOf("Invalid area code" to -1)
    }
}
/**
 * Given a dictionary of area data and a specific area code, 
 * this function returns the count of each species found in that area.
 * 
 * @param areaData A nested dictionary containing area data 
 * where the keys are area codes and values are dictionaries 
 * with species as keys and their count as values.
 * @param areaCode The specific area code for which the species count 
 * needs to be determined.
 * @return A dictionary containing the count of each species 
 * found in the specified area code.
 */
fun countSpeciesInArea(areaData: Map<String, Map<String, Int>>, areaCode: String): Map<String, Int> {
/**
 * Given a dictionary of area data and a specific area code, 
 * this function returns the count of each species found in that area.
 * 
 * @param areaData A nested dictionary containing area data 
 * where the keys are area codes and values are dictionaries 
 * with species as keys and their count as values.
 * @param areaCode The specific area code for which the species count 
 * needs to be determined.
 * @return A dictionary containing the count of each species 
 * found in the specified area code.
 */
fun countSpeciesInArea(areaData: Map<String, Map<String, Int>>, areaCode: String): Map<String, Int> {

    if (areaCode in areaData) {
        val speciesCount = mutableMapOf<String, Int>()
        for ((species, count) in areaData[areaCode]!!) {
            speciesCount[species] = speciesCount.getOrDefault(species, 0) + count
        }
        return speciesCount
    } else {
        return mapOf("Invalid area code" to -1)
    }
}