/**
 * Given a map 'doctors' containing doctor names as keys and their specialties as values, this function modifies the map
 * by replacing the value associated with 'oldName' key to 'newName' in an efficient manner.
 *
 * @param doctors A map representing doctor names and their specialties.
 * @param oldName The name of the doctor that needs to be modified.
 * @param newName The replacement name for the doctor.
 * @return The modified map with the doctor's name replaced.
 */
fun modifyDoctorName(doctors: MutableMap<String, String>, oldName: String, newName: String): MutableMap<String, String> {

    if (oldName in doctors) {  // Check if 'oldName' exists in the map 'doctors'
        doctors[newName] = doctors.remove(oldName)!!  // Rename the key and update the value
    }
    return doctors
}
/**
 * Given a map 'doctors' containing doctor names as keys and their specialties as values, this function modifies the map
 * by replacing the value associated with 'oldName' key to 'newName' in an efficient manner.
 *
 * @param doctors A map representing doctor names and their specialties.
 * @param oldName The name of the doctor that needs to be modified.
 * @param newName The replacement name for the doctor.
 * @return The modified map with the doctor's name replaced.
 */
fun modifyDoctorName(doctors: MutableMap<String, String>, oldName: String, newName: String): MutableMap<String, String> {
/**
 * Given a map 'doctors' containing doctor names as keys and their specialties as values, this function modifies the map
 * by replacing the value associated with 'oldName' key to 'newName' in an efficient manner.
 *
 * @param doctors A map representing doctor names and their specialties.
 * @param oldName The name of the doctor that needs to be modified.
 * @param newName The replacement name for the doctor.
 * @return The modified map with the doctor's name replaced.
 */
fun modifyDoctorName(doctors: MutableMap<String, String>, oldName: String, newName: String): MutableMap<String, String> {

    if (oldName in doctors) {  // Check if 'oldName' exists in the map 'doctors'
        doctors[newName] = doctors.remove(oldName)!!  // Rename the key and update the value
    }
    return doctors
}