/**
 * This exercise focuses on looping through a dictionary and looping through lists. The task is to find the intersection
 * of the elements in all the lists present as values in the given dictionary.
 *
 * @param teacherDict A dictionary containing lists as values.
 * @return A list containing the common elements present in all the lists.
 */
fun loopThroughListsInDictionary(teacherDict: Map<String, List<Any>>): List<Any> {

    // Initialize a set to store the common elements
    var commonElements = mutableSetOf<Any>()

    // Iterate over each key-value pair in the dictionary
    teacherDict.forEach { (_, value) ->
        // Check if the value is a list
        if (value is List<*>) {
            // If the commonElements set is empty, initialize it with the elements of the first list
            if (commonElements.isEmpty()) {
                commonElements = value.toMutableSet()
            } else {
                // Find the intersection of the current list and the commonElements set
                commonElements.retainAll(value)
            }
        }
    }

    // Return the list representation of the commonElements set
    return commonElements.toList()
}
/**
 * This exercise focuses on looping through a dictionary and looping through lists. The task is to find the intersection
 * of the elements in all the lists present as values in the given dictionary.
 *
 * @param teacherDict A dictionary containing lists as values.
 * @return A list containing the common elements present in all the lists.
 */
fun loopThroughListsInDictionary(teacherDict: Map<String, List<Any>>): List<Any> {
/**
 * This exercise focuses on looping through a dictionary and looping through lists. The task is to find the intersection
 * of the elements in all the lists present as values in the given dictionary.
 *
 * @param teacherDict A dictionary containing lists as values.
 * @return A list containing the common elements present in all the lists.
 */
fun loopThroughListsInDictionary(teacherDict: Map<String, List<Any>>): List<Any> {

    // Initialize a set to store the common elements
    var commonElements = mutableSetOf<Any>()

    // Iterate over each key-value pair in the dictionary
    teacherDict.forEach { (_, value) ->
        // Check if the value is a list
        if (value is List<*>) {
            // If the commonElements set is empty, initialize it with the elements of the first list
            if (commonElements.isEmpty()) {
                commonElements = value.toMutableSet()
            } else {
                // Find the intersection of the current list and the commonElements set
                commonElements.retainAll(value)
            }
        }
    }

    // Return the list representation of the commonElements set
    return commonElements.toList()
}