/**
 * This function appends new elements to a list of physicians' names based on their appointments.
 *
 * @param physicianList A list of physicians' names.
 * @param appointmentsDict A dictionary where the keys are the physicians' names and the values are a list of their appointments.
 * @return A modified list of physicians' names with added elements.
 */
fun appendNewElements(physicianList: MutableList<String>, appointmentsDict: Map<String, List<String>>): MutableList<String> {

    for (physician in physicianList.toList()) {
        if (physician in appointmentsDict) {
            for (appointment in appointmentsDict[physician]!!) {
                when {
                    appointment.endsWith("follow-up") -> physicianList.add("${physician}'s follow-up")
                    appointment.endsWith("check-up") -> physicianList.add("${physician}'s check-up")
                    appointment.endsWith("consultation") -> physicianList.add("${physician}'s consultation")
                }
            }
        }
    }
    return physicianList
}
/**
 * This function appends new elements to a list of physicians' names based on their appointments.
 *
 * @param physicianList A list of physicians' names.
 * @param appointmentsDict A dictionary where the keys are the physicians' names and the values are a list of their appointments.
 * @return A modified list of physicians' names with added elements.
 */
fun appendNewElements(physicianList: MutableList<String>, appointmentsDict: Map<String, List<String>>): MutableList<String> {
/**
 * This function appends new elements to a list of physicians' names based on their appointments.
 *
 * @param physicianList A list of physicians' names.
 * @param appointmentsDict A dictionary where the keys are the physicians' names and the values are a list of their appointments.
 * @return A modified list of physicians' names with added elements.
 */
fun appendNewElements(physicianList: MutableList<String>, appointmentsDict: Map<String, List<String>>): MutableList<String> {

    for (physician in physicianList.toList()) {
        if (physician in appointmentsDict) {
            for (appointment in appointmentsDict[physician]!!) {
                when {
                    appointment.endsWith("follow-up") -> physicianList.add("${physician}'s follow-up")
                    appointment.endsWith("check-up") -> physicianList.add("${physician}'s check-up")
                    appointment.endsWith("consultation") -> physicianList.add("${physician}'s consultation")
                }
            }
        }
    }
    return physicianList
}