/**
 * Given two actors, actor1 and actor2, and a list of movies they have acted in,
 * return a list of common movies in which both actors have appeared.
 *
 * Example:
 * actor1 = "Tom Hanks"
 * actor2 = "Meryl Streep"
 * movies = ["Forrest Gump", "The Post", "Catch Me If You Can", "Julie & Julia", "The Devil Wears Prada"]
 *
 * findCommonMovies(actor1, actor2, movies) should return ["The Post"]
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()
    
    // Iterate through each movie
    for (movie in movies) {
        // Check if both actors have appeared in the movie
        if (actor1 in movie && actor2 in movie) {
            commonMovies.add(movie)
        }
    }
    
    return commonMovies
}
/**
 * Given two actors, actor1 and actor2, and a list of movies they have acted in,
 * return a list of common movies in which both actors have appeared.
 *
 * Example:
 * actor1 = "Tom Hanks"
 * actor2 = "Meryl Streep"
 * movies = ["Forrest Gump", "The Post", "Catch Me If You Can", "Julie & Julia", "The Devil Wears Prada"]
 *
 * findCommonMovies(actor1, actor2, movies) should return ["The Post"]
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {
/**
 * Given two actors, actor1 and actor2, and a list of movies they have acted in,
 * return a list of common movies in which both actors have appeared.
 *
 * Example:
 * actor1 = "Tom Hanks"
 * actor2 = "Meryl Streep"
 * movies = ["Forrest Gump", "The Post", "Catch Me If You Can", "Julie & Julia", "The Devil Wears Prada"]
 *
 * findCommonMovies(actor1, actor2, movies) should return ["The Post"]
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()
    
    // Iterate through each movie
    for (movie in movies) {
        // Check if both actors have appeared in the movie
        if (actor1 in movie && actor2 in movie) {
            commonMovies.add(movie)
        }
    }
    
    return commonMovies
}