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

    val commonMovies = mutableListOf<String>()

    // Loop through each key-value pair in the map
    for ((movie, actors) in movies) {
        // Check if both actors are in the list of actors for the current movie
        if (actor1 in actors && actor2 in actors) {
            commonMovies.add(movie)
        }
    }

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

    val commonMovies = mutableListOf<String>()

    // Loop through each key-value pair in the map
    for ((movie, actors) in movies) {
        // Check if both actors are in the list of actors for the current movie
        if (actor1 in actors && actor2 in actors) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}