/**
 * This function takes a dictionary of animals and returns a list of common names in the dictionary.
 *
 * @param animals A dictionary of animals where the key represents the animal and the value represents its description.
 * @return A list of common names found in the dictionary.
 */
fun findCommonNames(animals: Map<String, String>): List<String> {

    val commonNames = mutableListOf<String>()
    val names = animals.keys.toList()

    for (i in names.indices) {
        for (j in i + 1 until names.size) {
            val name1 = names[i]
            val name2 = names[j]

            if (name1 === name2) {  // Identity comparison between two animal names
                commonNames.add(name1)
            }
        }
    }

    return commonNames
}

// Dictionary of animals with their descriptions
val animalDict = mapOf(
    "cat" to "Small, domesticated carnivorous mammal",
    "dog" to "Domesticated carnivorous mammal that typically has a long snout, an acute sense of smell, and a barking, howling, or whining voice",
    "lion" to "Large tawny-colored cat that lives in prides and is known for its majestic appearance and fierce nature",
    "tiger" to "Large..."
)
/**
 * This function takes a dictionary of animals and returns a list of common names in the dictionary.
 *
 * @param animals A dictionary of animals where the key represents the animal and the value represents its description.
 * @return A list of common names found in the dictionary.
 */
fun findCommonNames(animals: Map<String, String>): List<String> {
/**
 * This function takes a dictionary of animals and returns a list of common names in the dictionary.
 *
 * @param animals A dictionary of animals where the key represents the animal and the value represents its description.
 * @return A list of common names found in the dictionary.
 */
fun findCommonNames(animals: Map<String, String>): List<String> {

    val commonNames = mutableListOf<String>()
    val names = animals.keys.toList()

    for (i in names.indices) {
        for (j in i + 1 until names.size) {
            val name1 = names[i]
            val name2 = names[j]

            if (name1 === name2) {  // Identity comparison between two animal names
                commonNames.add(name1)
            }
        }
    }

    return commonNames
}

// Dictionary of animals with their descriptions
val animalDict = mapOf(
    "cat" to "Small, domesticated carnivorous mammal",
    "dog" to "Domesticated carnivorous mammal that typically has a long snout, an acute sense of smell, and a barking, howling, or whining voice",
    "lion" to "Large tawny-colored cat that lives in prides and is known for its majestic appearance and fierce nature",
    "tiger" to "Large..."
)