/**
 * Given a dictionary containing information about historical figures,
 * extract the names of all the figures and return them as a list.
 *
 * @param d A dictionary containing the information about historical figures.
 * @return A list of names of historical figures.
 */
fun extractNames(d: Map<String, Map<String, String>>): List<String> {

    val names = mutableListOf<String>()  // Initialize an empty list to store the names

    for (key in d.keys) {  // Iterate over the keys of the dictionary
        if ("name" in d[key]!!) {  // Check if the 'name' key exists in the value dictionary
            names.add(d[key]!!["name"]!!)  // Access the value of the 'name' key and add it to the names list
        }
    }

    return names  // Return the list of names
}
/**
 * Given a dictionary containing information about historical figures,
 * extract the names of all the figures and return them as a list.
 *
 * @param d A dictionary containing the information about historical figures.
 * @return A list of names of historical figures.
 */
fun extractNames(d: Map<String, Map<String, String>>): List<String> {
/**
 * Given a dictionary containing information about historical figures,
 * extract the names of all the figures and return them as a list.
 *
 * @param d A dictionary containing the information about historical figures.
 * @return A list of names of historical figures.
 */
fun extractNames(d: Map<String, Map<String, String>>): List<String> {

    val names = mutableListOf<String>()  // Initialize an empty list to store the names

    for (key in d.keys) {  // Iterate over the keys of the dictionary
        if ("name" in d[key]!!) {  // Check if the 'name' key exists in the value dictionary
            names.add(d[key]!!["name"]!!)  // Access the value of the 'name' key and add it to the names list
        }
    }

    return names  // Return the list of names
}