/**
 * Given two dictionaries, returns a set of common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A set of common elements between the two dictionaries.
 *
 * Example:
 * val dictionary1 = mapOf("A" to 1, "B" to 2, "C" to 3)
 * val dictionary2 = mapOf("B" to 4, "C" to 5, "D" to 6)
 * findCommonElements(dictionary1, dictionary2) // Output: setOf("B", "C")
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): Set<String> {

    val commonElements = mutableSetOf<String>() // Initialize an empty set to store the common elements

    // Loop through the keys in the first dictionary
    for (key in dictionary1.keys) {
        // Check if the key is present in the second dictionary
        if (dictionary2.containsKey(key)) {
            commonElements.add(key) // If present, add the key to the common elements set
        }
    }

    return commonElements
}
/**
 * Given two dictionaries, returns a set of common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A set of common elements between the two dictionaries.
 *
 * Example:
 * val dictionary1 = mapOf("A" to 1, "B" to 2, "C" to 3)
 * val dictionary2 = mapOf("B" to 4, "C" to 5, "D" to 6)
 * findCommonElements(dictionary1, dictionary2) // Output: setOf("B", "C")
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): Set<String> {
/**
 * Given two dictionaries, returns a set of common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A set of common elements between the two dictionaries.
 *
 * Example:
 * val dictionary1 = mapOf("A" to 1, "B" to 2, "C" to 3)
 * val dictionary2 = mapOf("B" to 4, "C" to 5, "D" to 6)
 * findCommonElements(dictionary1, dictionary2) // Output: setOf("B", "C")
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): Set<String> {

    val commonElements = mutableSetOf<String>() // Initialize an empty set to store the common elements

    // Loop through the keys in the first dictionary
    for (key in dictionary1.keys) {
        // Check if the key is present in the second dictionary
        if (dictionary2.containsKey(key)) {
            commonElements.add(key) // If present, add the key to the common elements set
        }
    }

    return commonElements
}