/**
 * Given two actors/actresses and a dictionary of movies they have acted in,
 * find the common movies in which they have both appeared.
 *
 * @param actor1 Name of the first actor/actress
 * @param actor2 Name of the second actor/actress
 * @param movies Dictionary mapping actor/actress to a list of movies they have acted in
 * @return A list of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Loop through the movies of actor1
    for (movie1 in movies[actor1]!!) {
        // Loop through the movies of actor2
        for (movie2 in movies[actor2]!!) {
            // Check if the movie is common to both actors
            if (movie1 == movie2) {
                // Append the common movie to the list
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}
/**
 * Given two actors/actresses and a dictionary of movies they have acted in,
 * find the common movies in which they have both appeared.
 *
 * @param actor1 Name of the first actor/actress
 * @param actor2 Name of the second actor/actress
 * @param movies Dictionary mapping actor/actress to a list of movies they have acted in
 * @return A list of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {
/**
 * Given two actors/actresses and a dictionary of movies they have acted in,
 * find the common movies in which they have both appeared.
 *
 * @param actor1 Name of the first actor/actress
 * @param actor2 Name of the second actor/actress
 * @param movies Dictionary mapping actor/actress to a list of movies they have acted in
 * @return A list of common movies in which both actors have appeared
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Loop through the movies of actor1
    for (movie1 in movies[actor1]!!) {
        // Loop through the movies of actor2
        for (movie2 in movies[actor2]!!) {
            // Check if the movie is common to both actors
            if (movie1 == movie2) {
                // Append the common movie to the list
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}