/**
 * This function takes in two actors/actresses and a list of movies
 * and returns the common movies in which both actors have appeared.
 *
 * @param actor1 Name of first actor/actress
 * @param actor2 Name of second actor/actress
 * @param movies List of pairs containing movie names and actors/actresses
 * @return List of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<Pair<String, List<String>>>): List<String> {

    val commonMovies = mutableListOf<String>()

    for (movie in movies) {
        val actorsList = movie.second

        if (actor1 in actorsList && actor2 in actorsList) {
            commonMovies.add(movie.first)
        }
    }

    return commonMovies
}
/**
 * This function takes in two actors/actresses and a list of movies
 * and returns the common movies in which both actors have appeared.
 *
 * @param actor1 Name of first actor/actress
 * @param actor2 Name of second actor/actress
 * @param movies List of pairs containing movie names and actors/actresses
 * @return List of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<Pair<String, List<String>>>): List<String> {
/**
 * This function takes in two actors/actresses and a list of movies
 * and returns the common movies in which both actors have appeared.
 *
 * @param actor1 Name of first actor/actress
 * @param actor2 Name of second actor/actress
 * @param movies List of pairs containing movie names and actors/actresses
 * @return List of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<Pair<String, List<String>>>): List<String> {

    val commonMovies = mutableListOf<String>()

    for (movie in movies) {
        val actorsList = movie.second

        if (actor1 in actorsList && actor2 in actorsList) {
            commonMovies.add(movie.first)
        }
    }

    return commonMovies
}