/**
 * Given a list of ingredients, replace a specified slice of elements with a new ingredient.
 *
 * @param ingredients A list of ingredients.
 * @param sliceStart The starting index of the slice to be replaced.
 * @param sliceEnd The ending index of the slice to be replaced.
 * @param replaceWith The ingredient to replace the specified slice with.
 * @return The updated list of ingredients.
 */
fun sliceReplaceIngredients(ingredients: MutableList<String>, sliceStart: Int, sliceEnd: Int, replaceWith: String): List<String> {

    var index = 0
    while (index < ingredients.size) {
        if (index >= sliceStart && index < sliceEnd) {
            ingredients[index] = replaceWith
        }
        index++
    }
    return ingredients
}
/**
 * Given a list of ingredients, replace a specified slice of elements with a new ingredient.
 *
 * @param ingredients A list of ingredients.
 * @param sliceStart The starting index of the slice to be replaced.
 * @param sliceEnd The ending index of the slice to be replaced.
 * @param replaceWith The ingredient to replace the specified slice with.
 * @return The updated list of ingredients.
 */
fun sliceReplaceIngredients(ingredients: MutableList<String>, sliceStart: Int, sliceEnd: Int, replaceWith: String): List<String> {
/**
 * Given a list of ingredients, replace a specified slice of elements with a new ingredient.
 *
 * @param ingredients A list of ingredients.
 * @param sliceStart The starting index of the slice to be replaced.
 * @param sliceEnd The ending index of the slice to be replaced.
 * @param replaceWith The ingredient to replace the specified slice with.
 * @return The updated list of ingredients.
 */
fun sliceReplaceIngredients(ingredients: MutableList<String>, sliceStart: Int, sliceEnd: Int, replaceWith: String): List<String> {

    var index = 0
    while (index < ingredients.size) {
        if (index >= sliceStart && index < sliceEnd) {
            ingredients[index] = replaceWith
        }
        index++
    }
    return ingredients
}