/**
 * Given a list representing the room and two colors represented by strings,
 * swap all occurrences of color1 with color2 and vice versa.
 *
 * @param room A list representing the colors of the room.
 * @param color1 The first color to be swapped.
 * @param color2 The second color to be swapped.
 * @return The modified list with swapped colors.
 *
 * Example:
 * swapColors(listOf("blue", "green", "red", "blue", "yellow"), "blue", "red")
 * Output: ["red", "green", "blue", "red", "yellow"]
 */
fun swapColors(room: MutableList<String>, color1: String, color2: String): List<String> {

    for (i in room.indices) {
        if (room[i] == color1) {
            room[i] = color2
        } else if (room[i] == color2) {
            room[i] = color1
        }
    }
    return room
}
/**
 * Given a list representing the room and two colors represented by strings,
 * swap all occurrences of color1 with color2 and vice versa.
 *
 * @param room A list representing the colors of the room.
 * @param color1 The first color to be swapped.
 * @param color2 The second color to be swapped.
 * @return The modified list with swapped colors.
 *
 * Example:
 * swapColors(listOf("blue", "green", "red", "blue", "yellow"), "blue", "red")
 * Output: ["red", "green", "blue", "red", "yellow"]
 */
fun swapColors(room: MutableList<String>, color1: String, color2: String): List<String> {
/**
 * Given a list representing the room and two colors represented by strings,
 * swap all occurrences of color1 with color2 and vice versa.
 *
 * @param room A list representing the colors of the room.
 * @param color1 The first color to be swapped.
 * @param color2 The second color to be swapped.
 * @return The modified list with swapped colors.
 *
 * Example:
 * swapColors(listOf("blue", "green", "red", "blue", "yellow"), "blue", "red")
 * Output: ["red", "green", "blue", "red", "yellow"]
 */
fun swapColors(room: MutableList<String>, color1: String, color2: String): List<String> {

    for (i in room.indices) {
        if (room[i] == color1) {
            room[i] = color2
        } else if (room[i] == color2) {
            room[i] = color1
        }
    }
    return room
}