/**
 * This exercise requires finding the common elements between two dictionaries based on the keys.
 *
 * Given two dictionaries, your task is to write a function that returns a list of common keys found in both dictionaries.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A list containing the common keys found in both dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 5)
 * val dict2 = mapOf("banana" to 4, "grape" to 1, "apple" to 2)
 * When calling findCommonElements(dict1, dict2), it should return ["apple", "banana"].
 */
fun findCommonElements(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {

    val commonKeys = mutableListOf<String>()

    for (key in dict1.keys) {
        if (key in dict2.keys) {
            commonKeys.add(key)
        }
    }

    return commonKeys
}
/**
 * This exercise requires finding the common elements between two dictionaries based on the keys.
 *
 * Given two dictionaries, your task is to write a function that returns a list of common keys found in both dictionaries.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A list containing the common keys found in both dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 5)
 * val dict2 = mapOf("banana" to 4, "grape" to 1, "apple" to 2)
 * When calling findCommonElements(dict1, dict2), it should return ["apple", "banana"].
 */
fun findCommonElements(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {
/**
 * This exercise requires finding the common elements between two dictionaries based on the keys.
 *
 * Given two dictionaries, your task is to write a function that returns a list of common keys found in both dictionaries.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A list containing the common keys found in both dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 5)
 * val dict2 = mapOf("banana" to 4, "grape" to 1, "apple" to 2)
 * When calling findCommonElements(dict1, dict2), it should return ["apple", "banana"].
 */
fun findCommonElements(dict1: Map<String, Int>, dict2: Map<String, Int>): List<String> {

    val commonKeys = mutableListOf<String>()

    for (key in dict1.keys) {
        if (key in dict2.keys) {
            commonKeys.add(key)
        }
    }

    return commonKeys
}