/**
 * This function takes in two actors/actresses and a dictionary of movies and their cast.
 * The function returns the list of common movies in which either of the actors/actresses has appeared.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @param movies Dictionary of movies and their corresponding cast.
 * @return List of common movies in which either of the actors/actresses has appeared.
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    for ((movie, cast) in movies) {
        if (actor1 in cast || actor2 in cast) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}
/**
 * This function takes in two actors/actresses and a dictionary of movies and their cast.
 * The function returns the list of common movies in which either of the actors/actresses has appeared.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @param movies Dictionary of movies and their corresponding cast.
 * @return List of common movies in which either of the actors/actresses has appeared.
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {
/**
 * This function takes in two actors/actresses and a dictionary of movies and their cast.
 * The function returns the list of common movies in which either of the actors/actresses has appeared.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @param movies Dictionary of movies and their corresponding cast.
 * @return List of common movies in which either of the actors/actresses has appeared.
 */
fun findCommonMovies(actor1: String, actor2: String, movies: Map<String, List<String>>): List<String> {

    val commonMovies = mutableListOf<String>()

    for ((movie, cast) in movies) {
        if (actor1 in cast || actor2 in cast) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}