/**
 * This exercise is for a Physical Therapist to calculate the total steps walked by each patient.
 *
 * Given a map 'patients' where the keys are patient names and the values are sets
 * containing the steps walked by each patient in a week, write a function that returns
 * a map 'totalSteps' with patient names as keys and their total steps walked as values.
 *
 * Example:
 * calculatePatientSteps(
 *     mapOf(
 *         "Jane" to setOf(1000, 2000, 3000, 4000, 5000),
 *         "John" to setOf(1500, 2500, 3500),
 *         "Alex" to setOf(2000, 4000, 6000, 8000)
 *     )
 * )
 * Output:
 * mapOf(
 *     "Jane" to 15000,
 *     "John" to 7500,
 *     "Alex" to 20000
 * )
 */
fun calculatePatientSteps(patients: Map<String, Set<Int>>): Map<String, Int> {

    val totalSteps = mutableMapOf<String, Int>()

    for ((patient, stepsSet) in patients) {
        totalSteps[patient] = 0
        for (steps in stepsSet) {
            totalSteps[patient] = totalSteps.getOrDefault(patient, 0) + steps
        }
    }

    return totalSteps
}
/**
 * This exercise is for a Physical Therapist to calculate the total steps walked by each patient.
 *
 * Given a map 'patients' where the keys are patient names and the values are sets
 * containing the steps walked by each patient in a week, write a function that returns
 * a map 'totalSteps' with patient names as keys and their total steps walked as values.
 *
 * Example:
 * calculatePatientSteps(
 *     mapOf(
 *         "Jane" to setOf(1000, 2000, 3000, 4000, 5000),
 *         "John" to setOf(1500, 2500, 3500),
 *         "Alex" to setOf(2000, 4000, 6000, 8000)
 *     )
 * )
 * Output:
 * mapOf(
 *     "Jane" to 15000,
 *     "John" to 7500,
 *     "Alex" to 20000
 * )
 */
fun calculatePatientSteps(patients: Map<String, Set<Int>>): Map<String, Int> {
/**
 * This exercise is for a Physical Therapist to calculate the total steps walked by each patient.
 *
 * Given a map 'patients' where the keys are patient names and the values are sets
 * containing the steps walked by each patient in a week, write a function that returns
 * a map 'totalSteps' with patient names as keys and their total steps walked as values.
 *
 * Example:
 * calculatePatientSteps(
 *     mapOf(
 *         "Jane" to setOf(1000, 2000, 3000, 4000, 5000),
 *         "John" to setOf(1500, 2500, 3500),
 *         "Alex" to setOf(2000, 4000, 6000, 8000)
 *     )
 * )
 * Output:
 * mapOf(
 *     "Jane" to 15000,
 *     "John" to 7500,
 *     "Alex" to 20000
 * )
 */
fun calculatePatientSteps(patients: Map<String, Set<Int>>): Map<String, Int> {

    val totalSteps = mutableMapOf<String, Int>()

    for ((patient, stepsSet) in patients) {
        totalSteps[patient] = 0
        for (steps in stepsSet) {
            totalSteps[patient] = totalSteps.getOrDefault(patient, 0) + steps
        }
    }

    return totalSteps
}