/**
 * Given a list of physical therapist names and a toggle index,
 * toggle the names based on the given index.
 *
 * @param physicalTherapistNames A list of physical therapist names.
 * @param toggleIndex An index to toggle the names.
 * @return The modified list of physical therapist names after toggling.
 *
 * Example:
 * toggleTheIndex(listOf("John", "Anne", "David", "Sara"), 2)
 * Output: ["David", "Anne", "John", "Sara"]
 */
fun toggleTheIndex(physicalTherapistNames: List<String>, toggleIndex: Int): List<String> {

    return physicalTherapistNames.mapIndexed { index, name ->
        if (index == toggleIndex) physicalTherapistNames[toggleIndex]
        else if (index == toggleIndex % physicalTherapistNames.size) physicalTherapistNames[0]
        else name
    }
}
/**
 * Given a list of physical therapist names and a toggle index,
 * toggle the names based on the given index.
 *
 * @param physicalTherapistNames A list of physical therapist names.
 * @param toggleIndex An index to toggle the names.
 * @return The modified list of physical therapist names after toggling.
 *
 * Example:
 * toggleTheIndex(listOf("John", "Anne", "David", "Sara"), 2)
 * Output: ["David", "Anne", "John", "Sara"]
 */
fun toggleTheIndex(physicalTherapistNames: List<String>, toggleIndex: Int): List<String> {
/**
 * Given a list of physical therapist names and a toggle index,
 * toggle the names based on the given index.
 *
 * @param physicalTherapistNames A list of physical therapist names.
 * @param toggleIndex An index to toggle the names.
 * @return The modified list of physical therapist names after toggling.
 *
 * Example:
 * toggleTheIndex(listOf("John", "Anne", "David", "Sara"), 2)
 * Output: ["David", "Anne", "John", "Sara"]
 */
fun toggleTheIndex(physicalTherapistNames: List<String>, toggleIndex: Int): List<String> {

    return physicalTherapistNames.mapIndexed { index, name ->
        if (index == toggleIndex) physicalTherapistNames[toggleIndex]
        else if (index == toggleIndex % physicalTherapistNames.size) physicalTherapistNames[0]
        else name
    }
}