/**
 * The function takes two actors/actresses as input and returns a list of common movies they have acted in.
 *
 * @param actor1 A pair containing the actor's name and a list of movies they have acted in.
 * @param actor2 A pair containing the actor's name and a list of movies they have acted in.
 * @return A list of common movies between the two actors.
 */
fun findCommonMovies(actor1: Pair<String, List<String>>, actor2: Pair<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Accessing the list of movies for each actor
    val list1 = actor1.second
    val list2 = actor2.second

    // Finding the common movies using intersection of two lists
    for (movie in list1) {
        if (movie in list2) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}
/**
 * The function takes two actors/actresses as input and returns a list of common movies they have acted in.
 *
 * @param actor1 A pair containing the actor's name and a list of movies they have acted in.
 * @param actor2 A pair containing the actor's name and a list of movies they have acted in.
 * @return A list of common movies between the two actors.
 */
fun findCommonMovies(actor1: Pair<String, List<String>>, actor2: Pair<String, List<String>>): List<String> {
/**
 * The function takes two actors/actresses as input and returns a list of common movies they have acted in.
 *
 * @param actor1 A pair containing the actor's name and a list of movies they have acted in.
 * @param actor2 A pair containing the actor's name and a list of movies they have acted in.
 * @return A list of common movies between the two actors.
 */
fun findCommonMovies(actor1: Pair<String, List<String>>, actor2: Pair<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Accessing the list of movies for each actor
    val list1 = actor1.second
    val list2 = actor2.second

    // Finding the common movies using intersection of two lists
    for (movie in list1) {
        if (movie in list2) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}