/**
 * You are given two dictionaries, 'dictionary1' and 'dictionary2', which contain information about archaeological sites.
 * Your task is to find the intersections of these dictionaries, i.e., the common keys that exist in both dictionaries.
 * Return a list of these common keys in alphabetical order.
 *
 * Hint: Use the "in" operator and iterate over one dictionary.
 *
 * Example:
 * val dictionary1 = mapOf("Site A" to "Neolithic", "Site B" to "Bronze Age", "Site C" to "Iron Age")
 * val dictionary2 = mapOf("Site B" to "Bronze Age", "Site C" to "Iron Age", "Site D" to "Roman")
 * findIntersection(dictionary1, dictionary2) => ['Site B', 'Site C']
 */
fun findIntersection(dictionary1: Map<String, String>, dictionary2: Map<String, String>): List<String> {

    val commonKeys = mutableListOf<String>()

    // Iterate over dictionary1
    for (key in dictionary1.keys) {
        // Check if key is present in dictionary2
        if (key in dictionary2 && key !in commonKeys) {
            commonKeys.add(key)
        }
    }

    return commonKeys.sorted()
}
/**
 * You are given two dictionaries, 'dictionary1' and 'dictionary2', which contain information about archaeological sites.
 * Your task is to find the intersections of these dictionaries, i.e., the common keys that exist in both dictionaries.
 * Return a list of these common keys in alphabetical order.
 *
 * Hint: Use the "in" operator and iterate over one dictionary.
 *
 * Example:
 * val dictionary1 = mapOf("Site A" to "Neolithic", "Site B" to "Bronze Age", "Site C" to "Iron Age")
 * val dictionary2 = mapOf("Site B" to "Bronze Age", "Site C" to "Iron Age", "Site D" to "Roman")
 * findIntersection(dictionary1, dictionary2) => ['Site B', 'Site C']
 */
fun findIntersection(dictionary1: Map<String, String>, dictionary2: Map<String, String>): List<String> {
/**
 * You are given two dictionaries, 'dictionary1' and 'dictionary2', which contain information about archaeological sites.
 * Your task is to find the intersections of these dictionaries, i.e., the common keys that exist in both dictionaries.
 * Return a list of these common keys in alphabetical order.
 *
 * Hint: Use the "in" operator and iterate over one dictionary.
 *
 * Example:
 * val dictionary1 = mapOf("Site A" to "Neolithic", "Site B" to "Bronze Age", "Site C" to "Iron Age")
 * val dictionary2 = mapOf("Site B" to "Bronze Age", "Site C" to "Iron Age", "Site D" to "Roman")
 * findIntersection(dictionary1, dictionary2) => ['Site B', 'Site C']
 */
fun findIntersection(dictionary1: Map<String, String>, dictionary2: Map<String, String>): List<String> {

    val commonKeys = mutableListOf<String>()

    // Iterate over dictionary1
    for (key in dictionary1.keys) {
        // Check if key is present in dictionary2
        if (key in dictionary2 && key !in commonKeys) {
            commonKeys.add(key)
        }
    }

    return commonKeys.sorted()
}