/**
 * This exercise is aimed at helping physicians find common patients between their list of patients and the hospital's list of patients.
 * You need to complete the code which loops through the physician's patients list and checks if each patient is also present in the hospital's patients list using the 'in' operator.
 * Finally, you should return a list of common patients found.
 */
fun findCommonElements(physicianPatients: List<String>, hospitalPatients: List<String>): List<String> {

    val commonPatients = mutableListOf<String>()

    for (patient in physicianPatients) {
        // Check if the patient is also present in the hospital's patients list
        if (patient in hospitalPatients) {
            commonPatients.add(patient)
        }
    }

    return commonPatients
}
/**
 * This exercise is aimed at helping physicians find common patients between their list of patients and the hospital's list of patients.
 * You need to complete the code which loops through the physician's patients list and checks if each patient is also present in the hospital's patients list using the 'in' operator.
 * Finally, you should return a list of common patients found.
 */
fun findCommonElements(physicianPatients: List<String>, hospitalPatients: List<String>): List<String> {
/**
 * This exercise is aimed at helping physicians find common patients between their list of patients and the hospital's list of patients.
 * You need to complete the code which loops through the physician's patients list and checks if each patient is also present in the hospital's patients list using the 'in' operator.
 * Finally, you should return a list of common patients found.
 */
fun findCommonElements(physicianPatients: List<String>, hospitalPatients: List<String>): List<String> {

    val commonPatients = mutableListOf<String>()

    for (patient in physicianPatients) {
        // Check if the patient is also present in the hospital's patients list
        if (patient in hospitalPatients) {
            commonPatients.add(patient)
        }
    }

    return commonPatients
}