/**
 * Counts the number of patients who have visited all the departments in a hospital.
 *
 * @param patientsList A list of dictionaries representing the patients, where each dictionary contains the
 *                     patient's name (String) and the departments (List) they have visited.
 * @return The number of patients that have visited all the departments.
 */
fun countPatients(patientsList: List<Map<String, Any>>): Int {

    var count = 0
    for (patient in patientsList) {
        val visitedDepartments = patient["departments"] as List<String>
        var allDepartmentsVisited = true
        for (department in visitedDepartments) {
            if (department !in patient) {
                allDepartmentsVisited = false
                break
            }
        }
        if (allDepartmentsVisited) {
            count++
        }
    }
    return count
}
/**
 * Counts the number of patients who have visited all the departments in a hospital.
 *
 * @param patientsList A list of dictionaries representing the patients, where each dictionary contains the
 *                     patient's name (String) and the departments (List) they have visited.
 * @return The number of patients that have visited all the departments.
 */
fun countPatients(patientsList: List<Map<String, Any>>): Int {
/**
 * Counts the number of patients who have visited all the departments in a hospital.
 *
 * @param patientsList A list of dictionaries representing the patients, where each dictionary contains the
 *                     patient's name (String) and the departments (List) they have visited.
 * @return The number of patients that have visited all the departments.
 */
fun countPatients(patientsList: List<Map<String, Any>>): Int {

    var count = 0
    for (patient in patientsList) {
        val visitedDepartments = patient["departments"] as List<String>
        var allDepartmentsVisited = true
        for (department in visitedDepartments) {
            if (department !in patient) {
                allDepartmentsVisited = false
                break
            }
        }
        if (allDepartmentsVisited) {
            count++
        }
    }
    return count
}