/**
 * Write a function that takes a dictionary as input and performs the following actions:
 * 1. Loop through the keys of the dictionary and display them in reverse order.
 * 2. Loop through the values of the dictionary and display them in reverse order with the First Letter Capitalized.
 * 3. Loop through the items of the dictionary and display the keys and values in reverse order as a string with "-" separator.
 * 4. Return the modified dictionary after removing the first and last elements.
 *
 * @param dictionary The dictionary to be processed.
 * @return The modified dictionary after removing the first and last elements.
 */
fun loopThroughDictionary(dictionary: Map<String, String>): Map<String, String> {

    // Loop through the keys and display them in reverse order
    val reversedKeys = dictionary.keys.reversed()
    println("Reversed Keys:")
    reversedKeys.forEach { println(it) }

    // Loop through the values and display them in reverse order with first letter capitalized
    val reversedValues = dictionary.values.map { it.capitalize() }.reversed()
    println("\nReversed Values:")
    reversedValues.forEach { println(it) }

    // Loop through the items and display keys and values in reverse order as a string with "-" separator
    println("\nReversed Items:")
    dictionary.entries.reversed().forEach { println("${it.key}-${it.value}") }

    // Return the modified dictionary after removing the first and last elements
    val modifiedDictionary = dictionary.toMutableMap()
    modifiedDictionary.remove(reversedKeys.first())
    modifiedDictionary.remove(reversedKeys.last())
    return modifiedDictionary
}
/**
 * Write a function that takes a dictionary as input and performs the following actions:
 * 1. Loop through the keys of the dictionary and display them in reverse order.
 * 2. Loop through the values of the dictionary and display them in reverse order with the First Letter Capitalized.
 * 3. Loop through the items of the dictionary and display the keys and values in reverse order as a string with "-" separator.
 * 4. Return the modified dictionary after removing the first and last elements.
 *
 * @param dictionary The dictionary to be processed.
 * @return The modified dictionary after removing the first and last elements.
 */
fun loopThroughDictionary(dictionary: Map<String, String>): Map<String, String> {
/**
 * Write a function that takes a dictionary as input and performs the following actions:
 * 1. Loop through the keys of the dictionary and display them in reverse order.
 * 2. Loop through the values of the dictionary and display them in reverse order with the First Letter Capitalized.
 * 3. Loop through the items of the dictionary and display the keys and values in reverse order as a string with "-" separator.
 * 4. Return the modified dictionary after removing the first and last elements.
 *
 * @param dictionary The dictionary to be processed.
 * @return The modified dictionary after removing the first and last elements.
 */
fun loopThroughDictionary(dictionary: Map<String, String>): Map<String, String> {

    // Loop through the keys and display them in reverse order
    val reversedKeys = dictionary.keys.reversed()
    println("Reversed Keys:")
    reversedKeys.forEach { println(it) }

    // Loop through the values and display them in reverse order with first letter capitalized
    val reversedValues = dictionary.values.map { it.capitalize() }.reversed()
    println("\nReversed Values:")
    reversedValues.forEach { println(it) }

    // Loop through the items and display keys and values in reverse order as a string with "-" separator
    println("\nReversed Items:")
    dictionary.entries.reversed().forEach { println("${it.key}-${it.value}") }

    // Return the modified dictionary after removing the first and last elements
    val modifiedDictionary = dictionary.toMutableMap()
    modifiedDictionary.remove(reversedKeys.first())
    modifiedDictionary.remove(reversedKeys.last())
    return modifiedDictionary
}