/**
 * Given two dictionaries, find the common keys and return their sum.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return The sum of the values for common keys in the dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 1)
 * val dict2 = mapOf("banana" to 4, "kiwi" to 5, "watermelon" to 2)
 * findCommonKeys(dict1, dict2) // Output: 6
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): Int {

    val commonKeys = dict1.keys.intersect(dict2.keys)
    return commonKeys.sumBy { key -> dict1.getValue(key) + dict2.getValue(key) }
}
/**
 * Given two dictionaries, find the common keys and return their sum.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return The sum of the values for common keys in the dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 1)
 * val dict2 = mapOf("banana" to 4, "kiwi" to 5, "watermelon" to 2)
 * findCommonKeys(dict1, dict2) // Output: 6
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): Int {
/**
 * Given two dictionaries, find the common keys and return their sum.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return The sum of the values for common keys in the dictionaries.
 *
 * Example:
 * val dict1 = mapOf("apple" to 3, "banana" to 2, "orange" to 1)
 * val dict2 = mapOf("banana" to 4, "kiwi" to 5, "watermelon" to 2)
 * findCommonKeys(dict1, dict2) // Output: 6
 */
fun findCommonKeys(dict1: Map<String, Int>, dict2: Map<String, Int>): Int {

    val commonKeys = dict1.keys.intersect(dict2.keys)
    return commonKeys.sumBy { key -> dict1.getValue(key) + dict2.getValue(key) }
}