/**
 * This function takes a list of dictionaries and returns the count of keys that are common in all dictionaries.
 *
 * @param dicts A list of dictionaries.
 * @return The count of keys that are common in all dictionaries.
 *
 * Examples:
 * '``
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8))
 * countCommonKeysInDicts(dicts) // Output: 1
 *
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8), mapOf("a" to 9))
 * countCommonKeysInDicts(dicts) // Output: 0
 * '``
 */
fun countCommonKeysInDicts(dicts: List<Map<String, Int>>): Int {

    var commonKeys = dicts[0].keys.toSet()

    for (d in dicts) {
        commonKeys = commonKeys.intersect(d.keys)
    }

    return commonKeys.size
}
/**
 * This function takes a list of dictionaries and returns the count of keys that are common in all dictionaries.
 *
 * @param dicts A list of dictionaries.
 * @return The count of keys that are common in all dictionaries.
 *
 * Examples:
 * '``
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8))
 * countCommonKeysInDicts(dicts) // Output: 1
 *
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8), mapOf("a" to 9))
 * countCommonKeysInDicts(dicts) // Output: 0
 * '``
 */
fun countCommonKeysInDicts(dicts: List<Map<String, Int>>): Int {
/**
 * This function takes a list of dictionaries and returns the count of keys that are common in all dictionaries.
 *
 * @param dicts A list of dictionaries.
 * @return The count of keys that are common in all dictionaries.
 *
 * Examples:
 * '``
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8))
 * countCommonKeysInDicts(dicts) // Output: 1
 *
 * val dicts = listOf(mapOf("a" to 1, "b" to 2, "c" to 3), mapOf("b" to 4, "c" to 5, "d" to 6), mapOf("c" to 7, "d" to 8), mapOf("a" to 9))
 * countCommonKeysInDicts(dicts) // Output: 0
 * '``
 */
fun countCommonKeysInDicts(dicts: List<Map<String, Int>>): Int {

    var commonKeys = dicts[0].keys.toSet()

    for (d in dicts) {
        commonKeys = commonKeys.intersect(d.keys)
    }

    return commonKeys.size
}