/**
 * This exercise aims to develop your skills in iterating over both dictionaries and sequences, while finding the common elements.
 *
 * Given a dictionary and a sequence, your task is to find the intersection of both using iteration. The intersection should contain elements that are present both in the dictionary keys and the sequence.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @param sequence A sequence of elements.
 * @return A list of elements that are present both in the dictionary keys and the sequence.
 */
fun findCommonElements(dictionary: Map<String, Any>, sequence: List<String>): List<String> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<String>()

    // Iterate over the dictionary items
    for (key in dictionary.keys) {
        // Check if the key is also present in the sequence
        if (key in sequence) {
            // Append the common key to the list
            commonElements.add(key)
        }
    }

    return commonElements
}
/**
 * This exercise aims to develop your skills in iterating over both dictionaries and sequences, while finding the common elements.
 *
 * Given a dictionary and a sequence, your task is to find the intersection of both using iteration. The intersection should contain elements that are present both in the dictionary keys and the sequence.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @param sequence A sequence of elements.
 * @return A list of elements that are present both in the dictionary keys and the sequence.
 */
fun findCommonElements(dictionary: Map<String, Any>, sequence: List<String>): List<String> {
/**
 * This exercise aims to develop your skills in iterating over both dictionaries and sequences, while finding the common elements.
 *
 * Given a dictionary and a sequence, your task is to find the intersection of both using iteration. The intersection should contain elements that are present both in the dictionary keys and the sequence.
 *
 * @param dictionary A dictionary containing key-value pairs.
 * @param sequence A sequence of elements.
 * @return A list of elements that are present both in the dictionary keys and the sequence.
 */
fun findCommonElements(dictionary: Map<String, Any>, sequence: List<String>): List<String> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<String>()

    // Iterate over the dictionary items
    for (key in dictionary.keys) {
        // Check if the key is also present in the sequence
        if (key in sequence) {
            // Append the common key to the list
            commonElements.add(key)
        }
    }

    return commonElements
}