/**
 * This function calculates the number of exercises completed by a patient
 * based on the intersection of therapy exercises and completed exercises.
 *
 * @param patientData A dictionary containing the patient's completed exercises
 * @param therapyData A dictionary containing the therapy exercises
 * @return A list of exercises completed by the patient from the therapy exercises
 */
fun calculateExercises(patientData: Map<String, Boolean>, therapyData: Map<String, Set<String>>): List<String> {

    val completedExercises = patientData.keys

    // Find the intersection of completed exercises and therapy exercises
    val intersection = mutableSetOf<String>()
    for (exerciseSet in therapyData.values) {
        intersection.addAll(exerciseSet)
    }

    // Create a list of exercises completed by the patient from the therapy exercises
    val exercisesCompleted = mutableListOf<String>()
    for (exercise in intersection) {
        if (completedExercises.contains(exercise)) {
            exercisesCompleted.add(exercise)
        }
    }

    return exercisesCompleted
}
/**
 * This function calculates the number of exercises completed by a patient
 * based on the intersection of therapy exercises and completed exercises.
 *
 * @param patientData A dictionary containing the patient's completed exercises
 * @param therapyData A dictionary containing the therapy exercises
 * @return A list of exercises completed by the patient from the therapy exercises
 */
fun calculateExercises(patientData: Map<String, Boolean>, therapyData: Map<String, Set<String>>): List<String> {
/**
 * This function calculates the number of exercises completed by a patient
 * based on the intersection of therapy exercises and completed exercises.
 *
 * @param patientData A dictionary containing the patient's completed exercises
 * @param therapyData A dictionary containing the therapy exercises
 * @return A list of exercises completed by the patient from the therapy exercises
 */
fun calculateExercises(patientData: Map<String, Boolean>, therapyData: Map<String, Set<String>>): List<String> {

    val completedExercises = patientData.keys

    // Find the intersection of completed exercises and therapy exercises
    val intersection = mutableSetOf<String>()
    for (exerciseSet in therapyData.values) {
        intersection.addAll(exerciseSet)
    }

    // Create a list of exercises completed by the patient from the therapy exercises
    val exercisesCompleted = mutableListOf<String>()
    for (exercise in intersection) {
        if (completedExercises.contains(exercise)) {
            exercisesCompleted.add(exercise)
        }
    }

    return exercisesCompleted
}