/**
 * Given the original nurse schedule and an updated schedule, update the nurse schedule
 * by replacing the original shifts with the updated ones.
 *
 * @param schedule The original nurse schedule.
 * @param update The updated nurse schedule.
 * @return The updated nurse schedule.
 *
 * Example:
 * updateNurseSchedule(listOf("Mon", "Tue", "Wed", "Thu", "Fri"), listOf("Mon", "Tue", "OFF", "Thu", "Fri"))
 * Output: ['Mon', 'Tue', 'OFF', 'Thu', 'Fri']
 */
fun updateNurseSchedule(schedule: List<String>, update: List<String>): List<String> {

    val updatedSchedule = mutableListOf<String>()
    for ((index, shift) in schedule.withIndex()) {
        if (shift == "OFF") {
            continue
        }
        for (updatedShift in update) {
            if (updatedShift == "OFF") {
                break
            }
            updatedSchedule.add(updatedShift)
            break
        }
    }
    return updatedSchedule
}
/**
 * Given the original nurse schedule and an updated schedule, update the nurse schedule
 * by replacing the original shifts with the updated ones.
 *
 * @param schedule The original nurse schedule.
 * @param update The updated nurse schedule.
 * @return The updated nurse schedule.
 *
 * Example:
 * updateNurseSchedule(listOf("Mon", "Tue", "Wed", "Thu", "Fri"), listOf("Mon", "Tue", "OFF", "Thu", "Fri"))
 * Output: ['Mon', 'Tue', 'OFF', 'Thu', 'Fri']
 */
fun updateNurseSchedule(schedule: List<String>, update: List<String>): List<String> {
/**
 * Given the original nurse schedule and an updated schedule, update the nurse schedule
 * by replacing the original shifts with the updated ones.
 *
 * @param schedule The original nurse schedule.
 * @param update The updated nurse schedule.
 * @return The updated nurse schedule.
 *
 * Example:
 * updateNurseSchedule(listOf("Mon", "Tue", "Wed", "Thu", "Fri"), listOf("Mon", "Tue", "OFF", "Thu", "Fri"))
 * Output: ['Mon', 'Tue', 'OFF', 'Thu', 'Fri']
 */
fun updateNurseSchedule(schedule: List<String>, update: List<String>): List<String> {

    val updatedSchedule = mutableListOf<String>()
    for ((index, shift) in schedule.withIndex()) {
        if (shift == "OFF") {
            continue
        }
        for (updatedShift in update) {
            if (updatedShift == "OFF") {
                break
            }
            updatedSchedule.add(updatedShift)
            break
        }
    }
    return updatedSchedule
}