/**
 * This function takes in the names of two actors or actresses, a list of movies, and finds the common movies they both have appeared in.
 *
 * @param actor1 Name of the first actor or actress
 * @param actor2 Name of the second actor or actress
 * @param movies List of movies
 * @return List of common movies
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()

    for (movie in movies) {
        if (actor1 in movie) {
            for (nestedMovie in movies) {
                if (nestedMovie == movie) {
                    continue
                }
                if (actor2 in nestedMovie) {
                    commonMovies.add(nestedMovie)
                }
            }
        }
    }

    return commonMovies
}
/**
 * This function takes in the names of two actors or actresses, a list of movies, and finds the common movies they both have appeared in.
 *
 * @param actor1 Name of the first actor or actress
 * @param actor2 Name of the second actor or actress
 * @param movies List of movies
 * @return List of common movies
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {
/**
 * This function takes in the names of two actors or actresses, a list of movies, and finds the common movies they both have appeared in.
 *
 * @param actor1 Name of the first actor or actress
 * @param actor2 Name of the second actor or actress
 * @param movies List of movies
 * @return List of common movies
 */
fun findCommonMovies(actor1: String, actor2: String, movies: List<String>): List<String> {

    val commonMovies = mutableListOf<String>()

    for (movie in movies) {
        if (actor1 in movie) {
            for (nestedMovie in movies) {
                if (nestedMovie == movie) {
                    continue
                }
                if (actor2 in nestedMovie) {
                    commonMovies.add(nestedMovie)
                }
            }
        }
    }

    return commonMovies
}