/**
 * This exercise requires the physician to iterate over a list of patients and perform indexing operations.
 *
 * @param physician The name of the physician.
 * @param patients A list of patient names.
 * @return The total count of patients that have "A" as the first letter of their name, and also have an even index.
 */
fun iterateAndIndex(physician: String, patients: List<String>): Int {

    var count = 0

    // Iterate over the patients list using a for loop
    for ((index, patient) in patients.withIndex()) {
        // Check if the current patient name starts with "A" and has an even index
        if (patient[0].toLowerCase() == 'a' && index % 2 == 0) {
            count++
        }
    }

    return count
}

val physician = "Dr. Smith"
val patients = listOf("Alice", "Bob", "Amy", "Andrew", "Alex", "Beth", "Adam", "Janet")

// The expected output for the given patients list would be 2,
// since "Alice" and "Andrew" have "A" as the first letter of their name, and also have an even index (0 and 3).
val result = iterateAndIndex(physician, patients)
/**
 * This exercise requires the physician to iterate over a list of patients and perform indexing operations.
 *
 * @param physician The name of the physician.
 * @param patients A list of patient names.
 * @return The total count of patients that have "A" as the first letter of their name, and also have an even index.
 */
fun iterateAndIndex(physician: String, patients: List<String>): Int {
/**
 * This exercise requires the physician to iterate over a list of patients and perform indexing operations.
 *
 * @param physician The name of the physician.
 * @param patients A list of patient names.
 * @return The total count of patients that have "A" as the first letter of their name, and also have an even index.
 */
fun iterateAndIndex(physician: String, patients: List<String>): Int {

    var count = 0

    // Iterate over the patients list using a for loop
    for ((index, patient) in patients.withIndex()) {
        // Check if the current patient name starts with "A" and has an even index
        if (patient[0].toLowerCase() == 'a' && index % 2 == 0) {
            count++
        }
    }

    return count
}

val physician = "Dr. Smith"
val patients = listOf("Alice", "Bob", "Amy", "Andrew", "Alex", "Beth", "Adam", "Janet")

// The expected output for the given patients list would be 2,
// since "Alice" and "Andrew" have "A" as the first letter of their name, and also have an even index (0 and 3).
val result = iterateAndIndex(physician, patients)