/**
 * Given two dictionaries, find and return the common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A list of common elements in both 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) -> ['B', 'C']
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): List<String> {

    val commonElements = mutableListOf<String>()

    // 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)
        }
    }

    return commonElements
}
/**
 * Given two dictionaries, find and return the common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A list of common elements in both 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) -> ['B', 'C']
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): List<String> {
/**
 * Given two dictionaries, find and return the common elements present in both dictionaries.
 *
 * @param dictionary1 The first dictionary.
 * @param dictionary2 The second dictionary.
 * @return A list of common elements in both 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) -> ['B', 'C']
 */
fun findCommonElements(dictionary1: Map<String, Int>, dictionary2: Map<String, Int>): List<String> {

    val commonElements = mutableListOf<String>()

    // 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)
        }
    }

    return commonElements
}