/**
 * Given a dictionary of animals with their names as keys and whether they are domestic or wild as values,
 * return a list of the names of the animals that match the provided condition.
 *
 * @param animalDict A dictionary of animals with their names as keys and whether they are domestic or wild as values.
 * @param isDomestic If true, return the names of domestic animals; otherwise, return the names of wild animals.
 * @return A list of animal names that match the given condition.
 */
fun getFarmAnimals(animalDict: Map<String, String>, isDomestic: Boolean): List<String> {

    val matchingAnimals = mutableListOf<String>()

    for ((animal, nature) in animalDict) {
        if (isDomestic) {
            if (nature == "domestic") {
                matchingAnimals.add(animal)
            }
        } else {
            if (nature == "wild") {
                matchingAnimals.add(animal)
            }
        }
    }

    return matchingAnimals
}

// Dictionary of animals with their nature (domestic or wild)
val animals = mapOf(
    "cow" to "domestic",
    "lion" to "wild",
    "sheep" to "domestic",
    "tiger" to "wild",
    "cat" to "domestic",
    "elephant" to "wild"
)
/**
 * Given a dictionary of animals with their names as keys and whether they are domestic or wild as values,
 * return a list of the names of the animals that match the provided condition.
 *
 * @param animalDict A dictionary of animals with their names as keys and whether they are domestic or wild as values.
 * @param isDomestic If true, return the names of domestic animals; otherwise, return the names of wild animals.
 * @return A list of animal names that match the given condition.
 */
fun getFarmAnimals(animalDict: Map<String, String>, isDomestic: Boolean): List<String> {
/**
 * Given a dictionary of animals with their names as keys and whether they are domestic or wild as values,
 * return a list of the names of the animals that match the provided condition.
 *
 * @param animalDict A dictionary of animals with their names as keys and whether they are domestic or wild as values.
 * @param isDomestic If true, return the names of domestic animals; otherwise, return the names of wild animals.
 * @return A list of animal names that match the given condition.
 */
fun getFarmAnimals(animalDict: Map<String, String>, isDomestic: Boolean): List<String> {

    val matchingAnimals = mutableListOf<String>()

    for ((animal, nature) in animalDict) {
        if (isDomestic) {
            if (nature == "domestic") {
                matchingAnimals.add(animal)
            }
        } else {
            if (nature == "wild") {
                matchingAnimals.add(animal)
            }
        }
    }

    return matchingAnimals
}

// Dictionary of animals with their nature (domestic or wild)
val animals = mapOf(
    "cow" to "domestic",
    "lion" to "wild",
    "sheep" to "domestic",
    "tiger" to "wild",
    "cat" to "domestic",
    "elephant" to "wild"
)