/**
 * This function takes two dictionaries, each mapping a country to a list of cities within that country.
 * The function returns a list of common cities in both dictionaries.
 * If a city in the first dictionary is not present in the second dictionary, it is skipped using 'continue'.
 * The function uses nested for loops and the 'continue' statement to solve the exercise.
 *
 * @param cities1 The first dictionary with country: cities mapping.
 * @param cities2 The second dictionary with country: cities mapping.
 * @return A list of common cities in both dictionaries.
 */
fun findCommonCities(cities1: Map<String, List<String>>, cities2: Map<String, List<String>>): List<String> {

    val commonCities = mutableListOf<String>()

    for ((country1, cityList1) in cities1) {
        for (city1 in cityList1) {
            for ((_, cityList2) in cities2) {
                if (city1 !in cityList2) {
                    continue
                }
                commonCities.add(city1)
                break
            }
        }
    }

    return commonCities
}
/**
 * This function takes two dictionaries, each mapping a country to a list of cities within that country.
 * The function returns a list of common cities in both dictionaries.
 * If a city in the first dictionary is not present in the second dictionary, it is skipped using 'continue'.
 * The function uses nested for loops and the 'continue' statement to solve the exercise.
 *
 * @param cities1 The first dictionary with country: cities mapping.
 * @param cities2 The second dictionary with country: cities mapping.
 * @return A list of common cities in both dictionaries.
 */
fun findCommonCities(cities1: Map<String, List<String>>, cities2: Map<String, List<String>>): List<String> {
/**
 * This function takes two dictionaries, each mapping a country to a list of cities within that country.
 * The function returns a list of common cities in both dictionaries.
 * If a city in the first dictionary is not present in the second dictionary, it is skipped using 'continue'.
 * The function uses nested for loops and the 'continue' statement to solve the exercise.
 *
 * @param cities1 The first dictionary with country: cities mapping.
 * @param cities2 The second dictionary with country: cities mapping.
 * @return A list of common cities in both dictionaries.
 */
fun findCommonCities(cities1: Map<String, List<String>>, cities2: Map<String, List<String>>): List<String> {

    val commonCities = mutableListOf<String>()

    for ((country1, cityList1) in cities1) {
        for (city1 in cityList1) {
            for ((_, cityList2) in cities2) {
                if (city1 !in cityList2) {
                    continue
                }
                commonCities.add(city1)
                break
            }
        }
    }

    return commonCities
}