/**
 * Given a dictionary, loop through its items and print the keys for the items whose values
 * are identical to the keys they belong to.
 *
 * Example:
 * dictionary = mapOf("apple" to "apple", "banana" to "pear", "pear" to "pear", "orange" to "kiwi")
 *
 * Expected Output:
 * Printing keys: apple pear
 */
fun loopDict(dictionary: Map<String, String>) {

    // Initialize an empty list to store the keys that satisfy the condition
    val identicalKeys = mutableListOf<String>()

    // Loop through each key-value pair in the dictionary
    for ((key, value) in dictionary) {
        // Check if the value is identical to the key
        if (value == key) {
            // Append the key to the identicalKeys list
            identicalKeys.add(key)
        }
    }

    // Print the keys that satisfy the condition
    println("Printing keys: ${identicalKeys.joinToString(" ")}")
}
/**
 * Given a dictionary, loop through its items and print the keys for the items whose values
 * are identical to the keys they belong to.
 *
 * Example:
 * dictionary = mapOf("apple" to "apple", "banana" to "pear", "pear" to "pear", "orange" to "kiwi")
 *
 * Expected Output:
 * Printing keys: apple pear
 */
fun loopDict(dictionary: Map<String, String>) {
/**
 * Given a dictionary, loop through its items and print the keys for the items whose values
 * are identical to the keys they belong to.
 *
 * Example:
 * dictionary = mapOf("apple" to "apple", "banana" to "pear", "pear" to "pear", "orange" to "kiwi")
 *
 * Expected Output:
 * Printing keys: apple pear
 */
fun loopDict(dictionary: Map<String, String>) {

    // Initialize an empty list to store the keys that satisfy the condition
    val identicalKeys = mutableListOf<String>()

    // Loop through each key-value pair in the dictionary
    for ((key, value) in dictionary) {
        // Check if the value is identical to the key
        if (value == key) {
            // Append the key to the identicalKeys list
            identicalKeys.add(key)
        }
    }

    // Print the keys that satisfy the condition
    println("Printing keys: ${identicalKeys.joinToString(" ")}")
}