/**
 * Given the names of two actors/actresses and a map of movies they have acted in,
 * write a function to find the movies in which both actors/actresses have appeared.
 *
 * @param actor1 The name of the first actor/actress.
 * @param actor2 The name of the second actor/actress.
 * @param movies A map of movies with keys as actor/actress names and values as lists of movies they have acted in.
 * @return A set of movies in which both actor1 and actor2 have appeared.
 */
fun getCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): Set<String> {

    val commonMovies = movies[actor1]?.intersect(movies[actor2] ?: emptySet()) ?: emptySet()
    return commonMovies.toSet()
}
/**
 * Given the names of two actors/actresses and a map of movies they have acted in,
 * write a function to find the movies in which both actors/actresses have appeared.
 *
 * @param actor1 The name of the first actor/actress.
 * @param actor2 The name of the second actor/actress.
 * @param movies A map of movies with keys as actor/actress names and values as lists of movies they have acted in.
 * @return A set of movies in which both actor1 and actor2 have appeared.
 */
fun getCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): Set<String> {
/**
 * Given the names of two actors/actresses and a map of movies they have acted in,
 * write a function to find the movies in which both actors/actresses have appeared.
 *
 * @param actor1 The name of the first actor/actress.
 * @param actor2 The name of the second actor/actress.
 * @param movies A map of movies with keys as actor/actress names and values as lists of movies they have acted in.
 * @return A set of movies in which both actor1 and actor2 have appeared.
 */
fun getCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): Set<String> {

    val commonMovies = movies[actor1]?.intersect(movies[actor2] ?: emptySet()) ?: emptySet()
    return commonMovies.toSet()
}