/**
 * Given two sets of dancers, this function checks if there is at least one dancer in both sets with the same age.
 *
 * @param people1 Set of dancers' ages for the first group
 * @param people2 Set of dancers' ages for the second group
 * @return True if at least one dancer has the same age in both sets, False otherwise
 */
fun isSameAge(people1: Set<Int>, people2: Set<Int>): Boolean {

    // Check if there is any intersection between the two sets
    if (people1.intersect(people2).isNotEmpty()) {
        // Iterate through each age value in the intersection set
        for (age in people1.intersect(people2)) {
            // Check if there is more than one dancer with the same age
            if (people1.count { it == age } > 1 || people2.count { it == age } > 1) {
                return true
            }
        }
    }
    return false
}
/**
 * Given two sets of dancers, this function checks if there is at least one dancer in both sets with the same age.
 *
 * @param people1 Set of dancers' ages for the first group
 * @param people2 Set of dancers' ages for the second group
 * @return True if at least one dancer has the same age in both sets, False otherwise
 */
fun isSameAge(people1: Set<Int>, people2: Set<Int>): Boolean {
/**
 * Given two sets of dancers, this function checks if there is at least one dancer in both sets with the same age.
 *
 * @param people1 Set of dancers' ages for the first group
 * @param people2 Set of dancers' ages for the second group
 * @return True if at least one dancer has the same age in both sets, False otherwise
 */
fun isSameAge(people1: Set<Int>, people2: Set<Int>): Boolean {

    // Check if there is any intersection between the two sets
    if (people1.intersect(people2).isNotEmpty()) {
        // Iterate through each age value in the intersection set
        for (age in people1.intersect(people2)) {
            // Check if there is more than one dancer with the same age
            if (people1.count { it == age } > 1 || people2.count { it == age } > 1) {
                return true
            }
        }
    }
    return false
}