/**
 * Given a list of furniture and a condition, delete the furniture that satisfies the condition.
 *
 * @param furnitureList A list of furniture items.
 * @param condition A condition to evaluate if a furniture item should be deleted.
 * @return The updated list of furniture items after deleting the matching elements.
 *
 * Example:
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "l") // Output: ["chair", "table", "couch"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "a") // Output: ["chair", "lamp", "couch", "mirror"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "o") // Output: ["lamp"]
 */
fun deleteFurniture(furnitureList: MutableList<String>, condition: Char): List<String> {

    var index = 0
    while (index < furnitureList.size) {
        if (condition in furnitureList[index]) {
            furnitureList.removeAt(index)
        } else {
            index++
        }
    }
    return furnitureList
}
/**
 * Given a list of furniture and a condition, delete the furniture that satisfies the condition.
 *
 * @param furnitureList A list of furniture items.
 * @param condition A condition to evaluate if a furniture item should be deleted.
 * @return The updated list of furniture items after deleting the matching elements.
 *
 * Example:
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "l") // Output: ["chair", "table", "couch"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "a") // Output: ["chair", "lamp", "couch", "mirror"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "o") // Output: ["lamp"]
 */
fun deleteFurniture(furnitureList: MutableList<String>, condition: Char): List<String> {
/**
 * Given a list of furniture and a condition, delete the furniture that satisfies the condition.
 *
 * @param furnitureList A list of furniture items.
 * @param condition A condition to evaluate if a furniture item should be deleted.
 * @return The updated list of furniture items after deleting the matching elements.
 *
 * Example:
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "l") // Output: ["chair", "table", "couch"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "a") // Output: ["chair", "lamp", "couch", "mirror"]
 * deleteFurniture(listOf("chair", "table", "lamp", "couch", "mirror"), "o") // Output: ["lamp"]
 */
fun deleteFurniture(furnitureList: MutableList<String>, condition: Char): List<String> {

    var index = 0
    while (index < furnitureList.size) {
        if (condition in furnitureList[index]) {
            furnitureList.removeAt(index)
        } else {
            index++
        }
    }
    return furnitureList
}