/**
 * A Farmer wants to remove the sheep from his farm but only on specific dates.
 * Modify the given list of farm animals by removing the sheep only on the specified dates.
 *
 * @param farmAnimals A list of farm animals.
 * @param dates A list of dates on which the sheep need to be removed.
 * @return The modified list of farm animals after removing the sheep on the specified dates.
 */
fun removeSheep(farmAnimals: MutableList<String>, dates: List<String>): List<String> {

    val iterator = farmAnimals.iterator()
    while (iterator.hasNext()) {
        val animal = iterator.next()
        for (day in dates) {
            if (animal == "sheep" && day != "BIRTHDAY") {
                iterator.remove()
            }
        }
    }
    return farmAnimals
}
/**
 * A Farmer wants to remove the sheep from his farm but only on specific dates.
 * Modify the given list of farm animals by removing the sheep only on the specified dates.
 *
 * @param farmAnimals A list of farm animals.
 * @param dates A list of dates on which the sheep need to be removed.
 * @return The modified list of farm animals after removing the sheep on the specified dates.
 */
fun removeSheep(farmAnimals: MutableList<String>, dates: List<String>): List<String> {
/**
 * A Farmer wants to remove the sheep from his farm but only on specific dates.
 * Modify the given list of farm animals by removing the sheep only on the specified dates.
 *
 * @param farmAnimals A list of farm animals.
 * @param dates A list of dates on which the sheep need to be removed.
 * @return The modified list of farm animals after removing the sheep on the specified dates.
 */
fun removeSheep(farmAnimals: MutableList<String>, dates: List<String>): List<String> {

    val iterator = farmAnimals.iterator()
    while (iterator.hasNext()) {
        val animal = iterator.next()
        for (day in dates) {
            if (animal == "sheep" && day != "BIRTHDAY") {
                iterator.remove()
            }
        }
    }
    return farmAnimals
}