/**
 * Given two dictionaries, find the items that are present in both dictionaries.
 *
 * @param d1 The first dictionary.
 * @param d2 The second dictionary.
 * @return A list of items present in both dictionaries.
 *
 * Example:
 * val d1 = mapOf("chair" to 4, "table" to 1, "lamp" to 2)
 * val d2 = mapOf("sofa" to 3, "chair" to 2, "lamp" to 1)
 * findMatchingItems(d1, d2) // Output: ['chair', 'lamp']
 */
fun findMatchingItems(d1: Map<String, Int>, d2: Map<String, Int>): List<String> {

    val matchingItems = mutableListOf<String>()

    for ((key, value) in d1) {
        if (d2.containsKey(key) && d2[key] == value) {
            matchingItems.add(key)
        }
    }

    return matchingItems
}
/**
 * Given two dictionaries, find the items that are present in both dictionaries.
 *
 * @param d1 The first dictionary.
 * @param d2 The second dictionary.
 * @return A list of items present in both dictionaries.
 *
 * Example:
 * val d1 = mapOf("chair" to 4, "table" to 1, "lamp" to 2)
 * val d2 = mapOf("sofa" to 3, "chair" to 2, "lamp" to 1)
 * findMatchingItems(d1, d2) // Output: ['chair', 'lamp']
 */
fun findMatchingItems(d1: Map<String, Int>, d2: Map<String, Int>): List<String> {
/**
 * Given two dictionaries, find the items that are present in both dictionaries.
 *
 * @param d1 The first dictionary.
 * @param d2 The second dictionary.
 * @return A list of items present in both dictionaries.
 *
 * Example:
 * val d1 = mapOf("chair" to 4, "table" to 1, "lamp" to 2)
 * val d2 = mapOf("sofa" to 3, "chair" to 2, "lamp" to 1)
 * findMatchingItems(d1, d2) // Output: ['chair', 'lamp']
 */
fun findMatchingItems(d1: Map<String, Int>, d2: Map<String, Int>): List<String> {

    val matchingItems = mutableListOf<String>()

    for ((key, value) in d1) {
        if (d2.containsKey(key) && d2[key] == value) {
            matchingItems.add(key)
        }
    }

    return matchingItems
}