/**
 * This exercise is aimed at practicing the basic syntax of a while loop and looping through sets with a for loop.
 * The goal is to find the common movies in which two actors have acted in.
 *
 * @param actor1 The name of the first actor.
 * @param actor2 The name of the second actor.
 * @return A set containing the common movies in which actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String): Set<String> {

    // Define the movie sets for each actor
    val moviesActor1 = setOf("Movie1", "Movie2", "Movie3", "Movie4")
    val moviesActor2 = setOf("Movie2", "Movie4", "Movie5", "Movie6")

    // Initialize the set for common movies
    val commonMovies = mutableSetOf<String>()

    // Loop through the movies of actor1 to find common ones with actor2
    for (movie1 in moviesActor1) {
        for (movie2 in moviesActor2) {
            if (movie1 == movie2) {
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}
/**
 * This exercise is aimed at practicing the basic syntax of a while loop and looping through sets with a for loop.
 * The goal is to find the common movies in which two actors have acted in.
 *
 * @param actor1 The name of the first actor.
 * @param actor2 The name of the second actor.
 * @return A set containing the common movies in which actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String): Set<String> {
/**
 * This exercise is aimed at practicing the basic syntax of a while loop and looping through sets with a for loop.
 * The goal is to find the common movies in which two actors have acted in.
 *
 * @param actor1 The name of the first actor.
 * @param actor2 The name of the second actor.
 * @return A set containing the common movies in which actor1 and actor2 have acted in.
 */
fun findCommonMovies(actor1: String, actor2: String): Set<String> {

    // Define the movie sets for each actor
    val moviesActor1 = setOf("Movie1", "Movie2", "Movie3", "Movie4")
    val moviesActor2 = setOf("Movie2", "Movie4", "Movie5", "Movie6")

    // Initialize the set for common movies
    val commonMovies = mutableSetOf<String>()

    // Loop through the movies of actor1 to find common ones with actor2
    for (movie1 in moviesActor1) {
        for (movie2 in moviesActor2) {
            if (movie1 == movie2) {
                commonMovies.add(movie1)
            }
        }
    }

    return commonMovies
}