/**
 * Given a list of patient names and their corresponding status (true for current patients and false for discharged),
 * return a list containing only the names of currently admitted patients, sorted in alphabetical order.
 *
 * @param patients A list of pairs, where each pair contains a patient's name and their status (true or false).
 * @return A list containing the names of currently admitted patients, sorted alphabetically.
 *
 * Examples:
 * patients = listOf(Pair("John", true), Pair("Alice", false), Pair("Robert", true), Pair("Eva", true), Pair("Liam", false))
 * nurseRecords(patients) // Output: ["Eva", "John", "Robert"]
 */
fun nurseRecords(patients: List<Pair<String, Boolean>>): List<String> {

    val admissionList = mutableListOf<String>()

    // Iterate through each pair in the list
    for (patient in patients) {
        val (name, status) = patient

        // Check if the patient is currently admitted (status = true)
        if (status) {
            // Append the name of the current patient to the admissionList
            admissionList.add(name)
        }
    }

    // Sort the admissionList in alphabetical order
    admissionList.sort()

    return admissionList
}
/**
 * Given a list of patient names and their corresponding status (true for current patients and false for discharged),
 * return a list containing only the names of currently admitted patients, sorted in alphabetical order.
 *
 * @param patients A list of pairs, where each pair contains a patient's name and their status (true or false).
 * @return A list containing the names of currently admitted patients, sorted alphabetically.
 *
 * Examples:
 * patients = listOf(Pair("John", true), Pair("Alice", false), Pair("Robert", true), Pair("Eva", true), Pair("Liam", false))
 * nurseRecords(patients) // Output: ["Eva", "John", "Robert"]
 */
fun nurseRecords(patients: List<Pair<String, Boolean>>): List<String> {
/**
 * Given a list of patient names and their corresponding status (true for current patients and false for discharged),
 * return a list containing only the names of currently admitted patients, sorted in alphabetical order.
 *
 * @param patients A list of pairs, where each pair contains a patient's name and their status (true or false).
 * @return A list containing the names of currently admitted patients, sorted alphabetically.
 *
 * Examples:
 * patients = listOf(Pair("John", true), Pair("Alice", false), Pair("Robert", true), Pair("Eva", true), Pair("Liam", false))
 * nurseRecords(patients) // Output: ["Eva", "John", "Robert"]
 */
fun nurseRecords(patients: List<Pair<String, Boolean>>): List<String> {

    val admissionList = mutableListOf<String>()

    // Iterate through each pair in the list
    for (patient in patients) {
        val (name, status) = patient

        // Check if the patient is currently admitted (status = true)
        if (status) {
            // Append the name of the current patient to the admissionList
            admissionList.add(name)
        }
    }

    // Sort the admissionList in alphabetical order
    admissionList.sort()

    return admissionList
}