/**
 * Given a dictionary of countries and their capitals, return a dictionary that contains the frequency
 * of each capital. The keys of the dictionary will be the capitals, and the values will be the number of
 * times each capital appears in the dictionary.
 *
 * @param countries A dictionary where the keys are country names and the values are capital names.
 * @return A dictionary where the keys are capitals and the values are the frequency of each capital.
 */
fun getCountriesWithCapitalFrequency(countries: Map<String, String>): Map<String, Int> {

    val capitalFrequency = mutableMapOf<String, Int>()

    // Iterate over the countries and capitals using entries
    for ((_, capital) in countries) {
        capitalFrequency[capital] = capitalFrequency.getOrDefault(capital, 0) + 1
    }

    return capitalFrequency
}
/**
 * Given a dictionary of countries and their capitals, return a dictionary that contains the frequency
 * of each capital. The keys of the dictionary will be the capitals, and the values will be the number of
 * times each capital appears in the dictionary.
 *
 * @param countries A dictionary where the keys are country names and the values are capital names.
 * @return A dictionary where the keys are capitals and the values are the frequency of each capital.
 */
fun getCountriesWithCapitalFrequency(countries: Map<String, String>): Map<String, Int> {
/**
 * Given a dictionary of countries and their capitals, return a dictionary that contains the frequency
 * of each capital. The keys of the dictionary will be the capitals, and the values will be the number of
 * times each capital appears in the dictionary.
 *
 * @param countries A dictionary where the keys are country names and the values are capital names.
 * @return A dictionary where the keys are capitals and the values are the frequency of each capital.
 */
fun getCountriesWithCapitalFrequency(countries: Map<String, String>): Map<String, Int> {

    val capitalFrequency = mutableMapOf<String, Int>()

    // Iterate over the countries and capitals using entries
    for ((_, capital) in countries) {
        capitalFrequency[capital] = capitalFrequency.getOrDefault(capital, 0) + 1
    }

    return capitalFrequency
}