/**
 * Given two dictionaries containing sets of geological elements found in different areas,
 * return the count of common elements between the two areas.
 *
 * @param dictionary1 Dictionary containing sets of elements found in area 1
 * @param dictionary2 Dictionary containing sets of elements found in area 2
 * @return Count of common elements found in both areas
 */
fun countCommonElements(dictionary1: Map<String, Set<String>>, dictionary2: Map<String, Set<String>>): Int {

    val commonElements = mutableSetOf<String>() // Create an empty set to store common elements

    // Iterate over each key-value pair in dictionary1
    for ((key1, value1) in dictionary1) {
        // Iterate over each element in value1 set
        for (element1 in value1) {
            // Iterate over each key-value pair in dictionary2
            for ((_, value2) in dictionary2) {
                // Check if element1 is present in value2 set
                if (element1 in value2) {
                    commonElements.add(element1) // Add element1 to commonElements set
                }
            }
        }
    }

    return commonElements.size // Return the count of common elements
}
/**
 * Given two dictionaries containing sets of geological elements found in different areas,
 * return the count of common elements between the two areas.
 *
 * @param dictionary1 Dictionary containing sets of elements found in area 1
 * @param dictionary2 Dictionary containing sets of elements found in area 2
 * @return Count of common elements found in both areas
 */
fun countCommonElements(dictionary1: Map<String, Set<String>>, dictionary2: Map<String, Set<String>>): Int {
/**
 * Given two dictionaries containing sets of geological elements found in different areas,
 * return the count of common elements between the two areas.
 *
 * @param dictionary1 Dictionary containing sets of elements found in area 1
 * @param dictionary2 Dictionary containing sets of elements found in area 2
 * @return Count of common elements found in both areas
 */
fun countCommonElements(dictionary1: Map<String, Set<String>>, dictionary2: Map<String, Set<String>>): Int {

    val commonElements = mutableSetOf<String>() // Create an empty set to store common elements

    // Iterate over each key-value pair in dictionary1
    for ((key1, value1) in dictionary1) {
        // Iterate over each element in value1 set
        for (element1 in value1) {
            // Iterate over each key-value pair in dictionary2
            for ((_, value2) in dictionary2) {
                // Check if element1 is present in value2 set
                if (element1 in value2) {
                    commonElements.add(element1) // Add element1 to commonElements set
                }
            }
        }
    }

    return commonElements.size // Return the count of common elements
}