/**
 * Given a list of materials used in a design project, replace all occurrences of a particular material
 * with a new material.
 *
 * @param materials A list of materials used in the project.
 * @param oldMaterial The material to be replaced.
 * @param newMaterial The new material to replace with.
 * @return The list of materials after performing the replacements.
 */
fun replaceMaterials(materials: MutableList<String>, oldMaterial: String, newMaterial: String): MutableList<String> {

    val modifiedMaterials = materials.toMutableList()

    for (i in modifiedMaterials.indices) {
        if (modifiedMaterials[i] == oldMaterial) {
            modifiedMaterials[i] = newMaterial
        }
    }

    return modifiedMaterials
}
/**
 * Given a list of materials used in a design project, replace all occurrences of a particular material
 * with a new material.
 *
 * @param materials A list of materials used in the project.
 * @param oldMaterial The material to be replaced.
 * @param newMaterial The new material to replace with.
 * @return The list of materials after performing the replacements.
 */
fun replaceMaterials(materials: MutableList<String>, oldMaterial: String, newMaterial: String): MutableList<String> {
/**
 * Given a list of materials used in a design project, replace all occurrences of a particular material
 * with a new material.
 *
 * @param materials A list of materials used in the project.
 * @param oldMaterial The material to be replaced.
 * @param newMaterial The new material to replace with.
 * @return The list of materials after performing the replacements.
 */
fun replaceMaterials(materials: MutableList<String>, oldMaterial: String, newMaterial: String): MutableList<String> {

    val modifiedMaterials = materials.toMutableList()

    for (i in modifiedMaterials.indices) {
        if (modifiedMaterials[i] == oldMaterial) {
            modifiedMaterials[i] = newMaterial
        }
    }

    return modifiedMaterials
}