/**
 * Given two lists of movies (movies1 and movies2),
 * find the common movies that both actors have acted in.
 * Return a list containing the common movies.
 *
 * @param actor1 List of movies the first actor has acted in.
 * @param actor2 List of movies the second actor has acted in.
 * @return List of common movies in both actor1 and actor2.
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Nested loop to compare each movie of actor1 with each movie of actor2
    for (movie1 in actor1) {
        for (movie2 in actor2) {
            // If the movies are the same, add it to the commonMovies list
            if (movie1 == movie2) {
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}
/**
 * Given two lists of movies (movies1 and movies2),
 * find the common movies that both actors have acted in.
 * Return a list containing the common movies.
 *
 * @param actor1 List of movies the first actor has acted in.
 * @param actor2 List of movies the second actor has acted in.
 * @return List of common movies in both actor1 and actor2.
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {
/**
 * Given two lists of movies (movies1 and movies2),
 * find the common movies that both actors have acted in.
 * Return a list containing the common movies.
 *
 * @param actor1 List of movies the first actor has acted in.
 * @param actor2 List of movies the second actor has acted in.
 * @return List of common movies in both actor1 and actor2.
 */
fun findCommonMovies(actor1: List<String>, actor2: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()

    // Nested loop to compare each movie of actor1 with each movie of actor2
    for (movie1 in actor1) {
        for (movie2 in actor2) {
            // If the movies are the same, add it to the commonMovies list
            if (movie1 == movie2) {
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}