/**
 * Given three dictionaries dict1, dict2, and dict3, the function should return a new dictionary
 * that contains only the common keys between the three dictionaries and the corresponding values
 * should be obtained using nested ternary operators.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @param dict3 Third dictionary.
 * @return Dictionary containing the common keys and their values obtained using nested ternary operators.
 */
fun nestedTernaryDict(dict1: Map<String, Int>, dict2: Map<String, Int>, dict3: Map<String, Int>): Map<String, Int> {

    val commonKeys = dict1.keys.intersect(dict2.keys).intersect(dict3.keys)
    val resultDict = mutableMapOf<String, Int>()

    for (key in commonKeys) {
        resultDict[key] = if (dict1[key]!! > dict2[key]!!) dict1[key]!!
        else if (dict1[key]!! > dict3[key]!!) dict3[key]!!
        else dict2[key]!!
    }

    return resultDict
}
/**
 * Given three dictionaries dict1, dict2, and dict3, the function should return a new dictionary
 * that contains only the common keys between the three dictionaries and the corresponding values
 * should be obtained using nested ternary operators.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @param dict3 Third dictionary.
 * @return Dictionary containing the common keys and their values obtained using nested ternary operators.
 */
fun nestedTernaryDict(dict1: Map<String, Int>, dict2: Map<String, Int>, dict3: Map<String, Int>): Map<String, Int> {
/**
 * Given three dictionaries dict1, dict2, and dict3, the function should return a new dictionary
 * that contains only the common keys between the three dictionaries and the corresponding values
 * should be obtained using nested ternary operators.
 *
 * @param dict1 First dictionary.
 * @param dict2 Second dictionary.
 * @param dict3 Third dictionary.
 * @return Dictionary containing the common keys and their values obtained using nested ternary operators.
 */
fun nestedTernaryDict(dict1: Map<String, Int>, dict2: Map<String, Int>, dict3: Map<String, Int>): Map<String, Int> {

    val commonKeys = dict1.keys.intersect(dict2.keys).intersect(dict3.keys)
    val resultDict = mutableMapOf<String, Int>()

    for (key in commonKeys) {
        resultDict[key] = if (dict1[key]!! > dict2[key]!!) dict1[key]!!
        else if (dict1[key]!! > dict3[key]!!) dict3[key]!!
        else dict2[key]!!
    }

    return resultDict
}