/**
 * Calculates the distance between two sets of physical therapy exercises performed by patients.
 *
 * @param patient1 Set of exercises performed by the first patient.
 * @param patient2 Set of exercises performed by the second patient.
 * @return The distance between the two sets in terms of unique exercises performed.
 */
fun calculateDistance(patient1: Set<String>, patient2: Set<String>): Int {

    // Get the unique exercises performed by each patient
    val uniqueExercisesPatient1 = HashSet<String>()
    val uniqueExercisesPatient2 = HashSet<String>()

    for (exercise in patient1) {
        if (exercise !in uniqueExercisesPatient1) {
            uniqueExercisesPatient1.add(exercise)
        }
    }

    for (exercise in patient2) {
        if (exercise !in uniqueExercisesPatient2) {
            uniqueExercisesPatient2.add(exercise)
        }
    }

    // Calculate the intersection of the two sets
    val intersectionSet = uniqueExercisesPatient1.intersect(uniqueExercisesPatient2)

    // Calculate the distance as the difference between the total unique exercises and the intersection size
    val distance = uniqueExercisesPatient1.size + uniqueExercisesPatient2.size - intersectionSet.size

    return distance
}

// Exercise: Find the patient
/**
 * Calculates the distance between two sets of physical therapy exercises performed by patients.
 *
 * @param patient1 Set of exercises performed by the first patient.
 * @param patient2 Set of exercises performed by the second patient.
 * @return The distance between the two sets in terms of unique exercises performed.
 */
fun calculateDistance(patient1: Set<String>, patient2: Set<String>): Int {
/**
 * Calculates the distance between two sets of physical therapy exercises performed by patients.
 *
 * @param patient1 Set of exercises performed by the first patient.
 * @param patient2 Set of exercises performed by the second patient.
 * @return The distance between the two sets in terms of unique exercises performed.
 */
fun calculateDistance(patient1: Set<String>, patient2: Set<String>): Int {

    // Get the unique exercises performed by each patient
    val uniqueExercisesPatient1 = HashSet<String>()
    val uniqueExercisesPatient2 = HashSet<String>()

    for (exercise in patient1) {
        if (exercise !in uniqueExercisesPatient1) {
            uniqueExercisesPatient1.add(exercise)
        }
    }

    for (exercise in patient2) {
        if (exercise !in uniqueExercisesPatient2) {
            uniqueExercisesPatient2.add(exercise)
        }
    }

    // Calculate the intersection of the two sets
    val intersectionSet = uniqueExercisesPatient1.intersect(uniqueExercisesPatient2)

    // Calculate the distance as the difference between the total unique exercises and the intersection size
    val distance = uniqueExercisesPatient1.size + uniqueExercisesPatient2.size - intersectionSet.size

    return distance
}

// Exercise: Find the patient