/**
 * Chef is preparing a special recipe but only wants to include ingredients that are not mentioned in the 'exclude' list.
 * You need to write a function that takes a list of ingredients and removes any ingredient that is present in the 'exclude' list using a loop and complement operator.
 *
 * @param ingredients A list of ingredients in the recipe.
 * @return A filtered list of ingredients excluding the ones present in the 'exclude' list.
 *
 * Example:
 * removeIngredients(listOf("sugar", "flour", "salt", "pepper"), listOf("sugar", "salt"))
 * Output: ['flour', 'pepper']
 */
fun removeIngredients(ingredients: MutableList<String>, exclude: List<String>): List<String> {

    // Loop through each ingredient in the 'ingredients' list
    val iterator = ingredients.iterator()
    while (iterator.hasNext()) {
        val ingredient = iterator.next()
        // Check if the ingredient is not in the 'exclude' list
        if (ingredient in exclude) {
            // Remove the ingredient from the 'ingredients' list
            iterator.remove()
        }
    }
    return ingredients
}
/**
 * Chef is preparing a special recipe but only wants to include ingredients that are not mentioned in the 'exclude' list.
 * You need to write a function that takes a list of ingredients and removes any ingredient that is present in the 'exclude' list using a loop and complement operator.
 *
 * @param ingredients A list of ingredients in the recipe.
 * @return A filtered list of ingredients excluding the ones present in the 'exclude' list.
 *
 * Example:
 * removeIngredients(listOf("sugar", "flour", "salt", "pepper"), listOf("sugar", "salt"))
 * Output: ['flour', 'pepper']
 */
fun removeIngredients(ingredients: MutableList<String>, exclude: List<String>): List<String> {
/**
 * Chef is preparing a special recipe but only wants to include ingredients that are not mentioned in the 'exclude' list.
 * You need to write a function that takes a list of ingredients and removes any ingredient that is present in the 'exclude' list using a loop and complement operator.
 *
 * @param ingredients A list of ingredients in the recipe.
 * @return A filtered list of ingredients excluding the ones present in the 'exclude' list.
 *
 * Example:
 * removeIngredients(listOf("sugar", "flour", "salt", "pepper"), listOf("sugar", "salt"))
 * Output: ['flour', 'pepper']
 */
fun removeIngredients(ingredients: MutableList<String>, exclude: List<String>): List<String> {

    // Loop through each ingredient in the 'ingredients' list
    val iterator = ingredients.iterator()
    while (iterator.hasNext()) {
        val ingredient = iterator.next()
        // Check if the ingredient is not in the 'exclude' list
        if (ingredient in exclude) {
            // Remove the ingredient from the 'ingredients' list
            iterator.remove()
        }
    }
    return ingredients
}