/**
 * Given two athletes, find the common activities they both participate in.
 *
 * @param athlete1 List of activities the first athlete participates in.
 * @param athlete2 List of activities the second athlete participates in.
 * @return A list of activities that both athletes participate in.
 */
fun findCommonActivities(athlete1: List<String>, athlete2: List<String>): List<String> {

    val commonActivities = mutableListOf<String>()

    // Nested loop to iterate over each activity of athlete1
    for (activity1 in athlete1) {
        // Nested loop to iterate over each activity of athlete2
        for (activity2 in athlete2) {
            // Check if the activities are the same
            if (activity1 == activity2) {
                // Add the common activity to the list
                commonActivities.add(activity1)
            }
        }
    }

    return commonActivities
}

// List of activities for athlete1
val athlete1Activities = listOf("running", "swimming", "cycling", "tennis", "hiking")
// List of activities for athlete2
val athlete2Activities = listOf("swimming", "football", "basketball", "cycling", "running")

// Find the common activities for the given athletes
val commonActivities = findCommonActivities(athlete1Activities, athlete2Activities)
/**
 * Given two athletes, find the common activities they both participate in.
 *
 * @param athlete1 List of activities the first athlete participates in.
 * @param athlete2 List of activities the second athlete participates in.
 * @return A list of activities that both athletes participate in.
 */
fun findCommonActivities(athlete1: List<String>, athlete2: List<String>): List<String> {
/**
 * Given two athletes, find the common activities they both participate in.
 *
 * @param athlete1 List of activities the first athlete participates in.
 * @param athlete2 List of activities the second athlete participates in.
 * @return A list of activities that both athletes participate in.
 */
fun findCommonActivities(athlete1: List<String>, athlete2: List<String>): List<String> {

    val commonActivities = mutableListOf<String>()

    // Nested loop to iterate over each activity of athlete1
    for (activity1 in athlete1) {
        // Nested loop to iterate over each activity of athlete2
        for (activity2 in athlete2) {
            // Check if the activities are the same
            if (activity1 == activity2) {
                // Add the common activity to the list
                commonActivities.add(activity1)
            }
        }
    }

    return commonActivities
}

// List of activities for athlete1
val athlete1Activities = listOf("running", "swimming", "cycling", "tennis", "hiking")
// List of activities for athlete2
val athlete2Activities = listOf("swimming", "football", "basketball", "cycling", "running")

// Find the common activities for the given athletes
val commonActivities = findCommonActivities(athlete1Activities, athlete2Activities)