/**
 * This function takes in a dictionary of organisms and counts the number of species within each kingdom.
 *
 * @param organism A dictionary of organisms categorized by kingdom and species.
 * @return A dictionary containing the count of species within each kingdom.
 */
fun countSpecies(organism: Map<String, List<String>>): Map<String, Int> {

    val speciesCount = mutableMapOf<String, Int>()
    for ((kingdom, speciesList) in organism) {
        for (species in speciesList) {
            if (kingdom !in speciesCount) {
                speciesCount[kingdom] = 0
            }
            if (species !in speciesCount) {
                speciesCount[kingdom] = speciesCount.getOrDefault(kingdom, 0) + 1
            }
        }
    }
    return speciesCount
}
/**
 * This function takes in a dictionary of organisms and counts the number of species within each kingdom.
 *
 * @param organism A dictionary of organisms categorized by kingdom and species.
 * @return A dictionary containing the count of species within each kingdom.
 */
fun countSpecies(organism: Map<String, List<String>>): Map<String, Int> {
/**
 * This function takes in a dictionary of organisms and counts the number of species within each kingdom.
 *
 * @param organism A dictionary of organisms categorized by kingdom and species.
 * @return A dictionary containing the count of species within each kingdom.
 */
fun countSpecies(organism: Map<String, List<String>>): Map<String, Int> {

    val speciesCount = mutableMapOf<String, Int>()
    for ((kingdom, speciesList) in organism) {
        for (species in speciesList) {
            if (kingdom !in speciesCount) {
                speciesCount[kingdom] = 0
            }
            if (species !in speciesCount) {
                speciesCount[kingdom] = speciesCount.getOrDefault(kingdom, 0) + 1
            }
        }
    }
    return speciesCount
}