/**
 * This exercise requires you to find the intersection of two lists of actress names, using the "greater than"
 * operator and a looping structure.
 *
 * @param nameList1 A list of actress names (e.g. ["Emma Stone", "Jennifer Lawrence", "Meryl Streep"])
 * @param nameList2 Another list of actress names (e.g. ["Jennifer Lawrence", "Scarlett Johansson", "Meryl Streep"])
 * @return A new list containing only the names that appear in both nameList1 and nameList2.
 */
fun actressIntersection(nameList1: List<String>, nameList2: List<String>): List<String> {

    // Initialize an empty list to store the common names
    val commonNames = mutableListOf<String>()

    // Loop through each name in the first list
    for (name1 in nameList1) {
        // Loop through each name in the second list
        for (name2 in nameList2) {
            // Check if name1 is greater than name2 (alphabetically)
            if (name1 > name2) {
                // If the names are equal, add it to the commonNames list
                if (name1 == name2) {
                    commonNames.add(name1)
                }
            }
        }
    }

    return commonNames
}
/**
 * This exercise requires you to find the intersection of two lists of actress names, using the "greater than"
 * operator and a looping structure.
 *
 * @param nameList1 A list of actress names (e.g. ["Emma Stone", "Jennifer Lawrence", "Meryl Streep"])
 * @param nameList2 Another list of actress names (e.g. ["Jennifer Lawrence", "Scarlett Johansson", "Meryl Streep"])
 * @return A new list containing only the names that appear in both nameList1 and nameList2.
 */
fun actressIntersection(nameList1: List<String>, nameList2: List<String>): List<String> {
/**
 * This exercise requires you to find the intersection of two lists of actress names, using the "greater than"
 * operator and a looping structure.
 *
 * @param nameList1 A list of actress names (e.g. ["Emma Stone", "Jennifer Lawrence", "Meryl Streep"])
 * @param nameList2 Another list of actress names (e.g. ["Jennifer Lawrence", "Scarlett Johansson", "Meryl Streep"])
 * @return A new list containing only the names that appear in both nameList1 and nameList2.
 */
fun actressIntersection(nameList1: List<String>, nameList2: List<String>): List<String> {

    // Initialize an empty list to store the common names
    val commonNames = mutableListOf<String>()

    // Loop through each name in the first list
    for (name1 in nameList1) {
        // Loop through each name in the second list
        for (name2 in nameList2) {
            // Check if name1 is greater than name2 (alphabetically)
            if (name1 > name2) {
                // If the names are equal, add it to the commonNames list
                if (name1 == name2) {
                    commonNames.add(name1)
                }
            }
        }
    }

    return commonNames
}