/**
 * Given a dictionary 'data' containing species as keys and their corresponding counts as values,
 * and a list 'speciesList' containing species names to search for, return the count of species
 * that are present in both the dictionary and the list.
 *
 * @param data A dictionary containing species as keys and their corresponding counts as values.
 * @param speciesList A list of species names to search for.
 * @return The count of species that are present in both the dictionary and the list.
 */
fun countSpecies(data: Map<String, Int>, speciesList: List<String>): Int {

    var count = 0  // Initialize count to 0
    
    for (species in speciesList) {  // Iterate over each species in the speciesList
        if (data.containsKey(species)) {  // Check if the species is present in the dictionary as a key
            count += data.getValue(species)  // Increment the count by the value associated with that species key
        }
    }
    
    return count
}
/**
 * Given a dictionary 'data' containing species as keys and their corresponding counts as values,
 * and a list 'speciesList' containing species names to search for, return the count of species
 * that are present in both the dictionary and the list.
 *
 * @param data A dictionary containing species as keys and their corresponding counts as values.
 * @param speciesList A list of species names to search for.
 * @return The count of species that are present in both the dictionary and the list.
 */
fun countSpecies(data: Map<String, Int>, speciesList: List<String>): Int {
/**
 * Given a dictionary 'data' containing species as keys and their corresponding counts as values,
 * and a list 'speciesList' containing species names to search for, return the count of species
 * that are present in both the dictionary and the list.
 *
 * @param data A dictionary containing species as keys and their corresponding counts as values.
 * @param speciesList A list of species names to search for.
 * @return The count of species that are present in both the dictionary and the list.
 */
fun countSpecies(data: Map<String, Int>, speciesList: List<String>): Int {

    var count = 0  // Initialize count to 0
    
    for (species in speciesList) {  // Iterate over each species in the speciesList
        if (data.containsKey(species)) {  // Check if the species is present in the dictionary as a key
            count += data.getValue(species)  // Increment the count by the value associated with that species key
        }
    }
    
    return count
}