/**
 * This function takes a list of patients and a list of exercises,
 * and counts how many times each exercise is assigned to each patient.
 *
 * @param patientList A list of patients
 * @param exerciseList A list of exercises
 * @return A nested dictionary where the keys represent patients and the values represent another dictionary,
 * where the keys represent exercises and the values represent the count of assignments.
 */
fun countExercises(patientList: List<String>, exerciseList: List<String>): Map<String, Map<String, Int>> {

    val assignmentCount = mutableMapOf<String, MutableMap<String, Int>>()

    // Nested loop to iterate over patients and exercises
    for (patient in patientList) {
        if (patient !in assignmentCount) {
            assignmentCount[patient] = mutableMapOf()  // create an empty dictionary for the patient
        }

        for (exercise in exerciseList) {
            if (exercise !in assignmentCount[patient]!!) {
                assignmentCount[patient]!![exercise] = 1  // assign the exercise for the patient
            } else {
                assignmentCount[patient]!![exercise] = assignmentCount[patient]!![exercise]!! + 1  // increment the exercise count
            }
        }
    }

    return assignmentCount
}
/**
 * This function takes a list of patients and a list of exercises,
 * and counts how many times each exercise is assigned to each patient.
 *
 * @param patientList A list of patients
 * @param exerciseList A list of exercises
 * @return A nested dictionary where the keys represent patients and the values represent another dictionary,
 * where the keys represent exercises and the values represent the count of assignments.
 */
fun countExercises(patientList: List<String>, exerciseList: List<String>): Map<String, Map<String, Int>> {
/**
 * This function takes a list of patients and a list of exercises,
 * and counts how many times each exercise is assigned to each patient.
 *
 * @param patientList A list of patients
 * @param exerciseList A list of exercises
 * @return A nested dictionary where the keys represent patients and the values represent another dictionary,
 * where the keys represent exercises and the values represent the count of assignments.
 */
fun countExercises(patientList: List<String>, exerciseList: List<String>): Map<String, Map<String, Int>> {

    val assignmentCount = mutableMapOf<String, MutableMap<String, Int>>()

    // Nested loop to iterate over patients and exercises
    for (patient in patientList) {
        if (patient !in assignmentCount) {
            assignmentCount[patient] = mutableMapOf()  // create an empty dictionary for the patient
        }

        for (exercise in exerciseList) {
            if (exercise !in assignmentCount[patient]!!) {
                assignmentCount[patient]!![exercise] = 1  // assign the exercise for the patient
            } else {
                assignmentCount[patient]!![exercise] = assignmentCount[patient]!![exercise]!! + 1  // increment the exercise count
            }
        }
    }

    return assignmentCount
}