/**
 * This function takes in three arguments:
 * - actor1: the name of actor 1 (string)
 * - actor2: the name of actor 2 (string)
 * - movieList: a dictionary mapping actors to a list of movies they have acted in (dictionary)
 *
 * The function returns a list of common movies that both actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String, movieList: Map<String, List<String>>): List<String> {

    // Initialize an empty list to store the common movies
    val commonMovies = mutableListOf<String>()

    // Iterate over the movies of actor1
    for (movie in movieList[actor1]!!) {
        // Check if the movie is present in the movies of actor2
        if (movie in movieList[actor2]!!) {
            // Add the common movie to the list
            commonMovies.add(movie)
        }
    }

    return commonMovies
}
/**
 * This function takes in three arguments:
 * - actor1: the name of actor 1 (string)
 * - actor2: the name of actor 2 (string)
 * - movieList: a dictionary mapping actors to a list of movies they have acted in (dictionary)
 *
 * The function returns a list of common movies that both actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String, movieList: Map<String, List<String>>): List<String> {
/**
 * This function takes in three arguments:
 * - actor1: the name of actor 1 (string)
 * - actor2: the name of actor 2 (string)
 * - movieList: a dictionary mapping actors to a list of movies they have acted in (dictionary)
 *
 * The function returns a list of common movies that both actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String, movieList: Map<String, List<String>>): List<String> {

    // Initialize an empty list to store the common movies
    val commonMovies = mutableListOf<String>()

    // Iterate over the movies of actor1
    for (movie in movieList[actor1]!!) {
        // Check if the movie is present in the movies of actor2
        if (movie in movieList[actor2]!!) {
            // Add the common movie to the list
            commonMovies.add(movie)
        }
    }

    return commonMovies
}