/**
 * This function takes a list of animal names and a list of farm names as input, and returns a list of strings
 * where each string represents the intersection of the animal and farm names using a ternary operator.
 *
 * @param animalList List of animal names
 * @param farmList List of farm names
 * @return List of strings representing the intersection of animal and farm names
 */
fun addFarmAnimals(animalList: List<String>, farmList: List<String>): List<String> {

    val intersectionList = mutableListOf<String>()

    for (animal in animalList) {
        for (farm in farmList) {
            val intersection = if (animal[0] == farm[farm.length - 1]) {
                "$animal is on $farm"
            } else {
                "$animal is not on $farm"
            }
            intersectionList.add(intersection)
        }
    }

    return intersectionList
}

// Example usage
val animalNames = addFarmAnimals(listOf("Dog", "Cat"), listOf("Farm1", "Farm2"))
/**
 * This function takes a list of animal names and a list of farm names as input, and returns a list of strings
 * where each string represents the intersection of the animal and farm names using a ternary operator.
 *
 * @param animalList List of animal names
 * @param farmList List of farm names
 * @return List of strings representing the intersection of animal and farm names
 */
fun addFarmAnimals(animalList: List<String>, farmList: List<String>): List<String> {
/**
 * This function takes a list of animal names and a list of farm names as input, and returns a list of strings
 * where each string represents the intersection of the animal and farm names using a ternary operator.
 *
 * @param animalList List of animal names
 * @param farmList List of farm names
 * @return List of strings representing the intersection of animal and farm names
 */
fun addFarmAnimals(animalList: List<String>, farmList: List<String>): List<String> {

    val intersectionList = mutableListOf<String>()

    for (animal in animalList) {
        for (farm in farmList) {
            val intersection = if (animal[0] == farm[farm.length - 1]) {
                "$animal is on $farm"
            } else {
                "$animal is not on $farm"
            }
            intersectionList.add(intersection)
        }
    }

    return intersectionList
}

// Example usage
val animalNames = addFarmAnimals(listOf("Dog", "Cat"), listOf("Farm1", "Farm2"))