/**
 * Given a list of patients and a specific condition, 
 * this function should return the first patient who has that condition.
 *
 * @param patients A list of patient names (strings).
 * @param condition The condition to be searched for.
 * @return The name of the patient with the given condition or null if no patient has it.
 *
 * Example:
 * patients = ["John Doe", "Alice Smith", "Jack Johnson", "Jane Brown"]
 * findPatientWithCondition(patients, "flu") -> "John Doe"
 * findPatientWithCondition(patients, "covid") -> "Jack Johnson"
 * findPatientWithCondition(patients, "migraine") -> null
 */
fun findPatientWithCondition(patients: List<String>, condition: String): String? {

    var index = 0
    while (index < patients.size) {
        val patient = patients[index]
        if (condition in patient) {
            return patient
        }
        index++
    }
    return null
}
/**
 * Given a list of patients and a specific condition, 
 * this function should return the first patient who has that condition.
 *
 * @param patients A list of patient names (strings).
 * @param condition The condition to be searched for.
 * @return The name of the patient with the given condition or null if no patient has it.
 *
 * Example:
 * patients = ["John Doe", "Alice Smith", "Jack Johnson", "Jane Brown"]
 * findPatientWithCondition(patients, "flu") -> "John Doe"
 * findPatientWithCondition(patients, "covid") -> "Jack Johnson"
 * findPatientWithCondition(patients, "migraine") -> null
 */
fun findPatientWithCondition(patients: List<String>, condition: String): String? {
/**
 * Given a list of patients and a specific condition, 
 * this function should return the first patient who has that condition.
 *
 * @param patients A list of patient names (strings).
 * @param condition The condition to be searched for.
 * @return The name of the patient with the given condition or null if no patient has it.
 *
 * Example:
 * patients = ["John Doe", "Alice Smith", "Jack Johnson", "Jane Brown"]
 * findPatientWithCondition(patients, "flu") -> "John Doe"
 * findPatientWithCondition(patients, "covid") -> "Jack Johnson"
 * findPatientWithCondition(patients, "migraine") -> null
 */
fun findPatientWithCondition(patients: List<String>, condition: String): String? {

    var index = 0
    while (index < patients.size) {
        val patient = patients[index]
        if (condition in patient) {
            return patient
        }
        index++
    }
    return null
}