/**
 * This function takes two actors and a list of movies as input and returns a list of common movies between them.
 *
 * @param actor1 Name of the first actor
 * @param actor2 Name of the second actor
 * @param movies List of movies
 * @return List of common movies between actor1 and actor2
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

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

    for (movie in movies) {  // Iterating through each movie in the list
        val actors = movie.split(',')  // Splitting the movie string into individual actors

        if (actor1 in actors && actor2 in actors) {  // Checking if both actors are present in the movie
            commonMovies.add(movie)  // Adding the movie to the commonMovies list
        }
    }

    return commonMovies
}
/**
 * This function takes two actors and a list of movies as input and returns a list of common movies between them.
 *
 * @param actor1 Name of the first actor
 * @param actor2 Name of the second actor
 * @param movies List of movies
 * @return List of common movies between actor1 and actor2
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {
/**
 * This function takes two actors and a list of movies as input and returns a list of common movies between them.
 *
 * @param actor1 Name of the first actor
 * @param actor2 Name of the second actor
 * @param movies List of movies
 * @return List of common movies between actor1 and actor2
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

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

    for (movie in movies) {  // Iterating through each movie in the list
        val actors = movie.split(',')  // Splitting the movie string into individual actors

        if (actor1 in actors && actor2 in actors) {  // Checking if both actors are present in the movie
            commonMovies.add(movie)  // Adding the movie to the commonMovies list
        }
    }

    return commonMovies
}