/**
 * Given a dictionary where keys are the names of movies and values are lists of actors/actresses,
 * find the common actors/actresses that appear in all the movies.
 *
 * Example:
 * movies = mapOf(
 *     "Movie 1" to listOf("Actor1", "Actor2", "Actor3"),
 *     "Movie 2" to listOf("Actor2", "Actor3", "Actor4"),
 *     "Movie 3" to listOf("Actor3", "Actor4", "Actor5")
 * )
 * findCommonActors(movies) => ["Actor3"]
 *
 * @param movies A dictionary containing movie names as keys and lists of actors/actresses as values
 * @return A list of actors/actresses that appear in all the movies
 */
fun findCommonActors(movies: Map<String, List<String>>): List<String> {

    var commonActors = movies.values.first().toSet()
    for (movie in movies) {
        commonActors = commonActors.intersect(movie.value.toSet())
    }
    return commonActors.toList()
}
/**
 * Given a dictionary where keys are the names of movies and values are lists of actors/actresses,
 * find the common actors/actresses that appear in all the movies.
 *
 * Example:
 * movies = mapOf(
 *     "Movie 1" to listOf("Actor1", "Actor2", "Actor3"),
 *     "Movie 2" to listOf("Actor2", "Actor3", "Actor4"),
 *     "Movie 3" to listOf("Actor3", "Actor4", "Actor5")
 * )
 * findCommonActors(movies) => ["Actor3"]
 *
 * @param movies A dictionary containing movie names as keys and lists of actors/actresses as values
 * @return A list of actors/actresses that appear in all the movies
 */
fun findCommonActors(movies: Map<String, List<String>>): List<String> {
/**
 * Given a dictionary where keys are the names of movies and values are lists of actors/actresses,
 * find the common actors/actresses that appear in all the movies.
 *
 * Example:
 * movies = mapOf(
 *     "Movie 1" to listOf("Actor1", "Actor2", "Actor3"),
 *     "Movie 2" to listOf("Actor2", "Actor3", "Actor4"),
 *     "Movie 3" to listOf("Actor3", "Actor4", "Actor5")
 * )
 * findCommonActors(movies) => ["Actor3"]
 *
 * @param movies A dictionary containing movie names as keys and lists of actors/actresses as values
 * @return A list of actors/actresses that appear in all the movies
 */
fun findCommonActors(movies: Map<String, List<String>>): List<String> {

    var commonActors = movies.values.first().toSet()
    for (movie in movies) {
        commonActors = commonActors.intersect(movie.value.toSet())
    }
    return commonActors.toList()
}