/**
 * Given two actors, actor1 and actor2, finds the common movies they both have worked in.
 *
 * @param actor1 Set containing the movies actor1 has worked in.
 * @param actor2 Set containing the movies actor2 has worked in.
 * @return Set containing the common movies the actors have worked in.
 *
 * Example:
 * actor1 = setOf("Movie A", "Movie B", "Movie C")
 * actor2 = setOf("Movie B", "Movie C", "Movie D")
 * findCommonMovies(actor1, actor2) => setOf("Movie B", "Movie C")
 */
fun findCommonMovies(actor1: Set<String>, actor2: Set<String>): Set<String> {

    val commonMovies = mutableSetOf<String>()

    for (movie in actor1) {
        if (movie in actor2) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}
/**
 * Given two actors, actor1 and actor2, finds the common movies they both have worked in.
 *
 * @param actor1 Set containing the movies actor1 has worked in.
 * @param actor2 Set containing the movies actor2 has worked in.
 * @return Set containing the common movies the actors have worked in.
 *
 * Example:
 * actor1 = setOf("Movie A", "Movie B", "Movie C")
 * actor2 = setOf("Movie B", "Movie C", "Movie D")
 * findCommonMovies(actor1, actor2) => setOf("Movie B", "Movie C")
 */
fun findCommonMovies(actor1: Set<String>, actor2: Set<String>): Set<String> {
/**
 * Given two actors, actor1 and actor2, finds the common movies they both have worked in.
 *
 * @param actor1 Set containing the movies actor1 has worked in.
 * @param actor2 Set containing the movies actor2 has worked in.
 * @return Set containing the common movies the actors have worked in.
 *
 * Example:
 * actor1 = setOf("Movie A", "Movie B", "Movie C")
 * actor2 = setOf("Movie B", "Movie C", "Movie D")
 * findCommonMovies(actor1, actor2) => setOf("Movie B", "Movie C")
 */
fun findCommonMovies(actor1: Set<String>, actor2: Set<String>): Set<String> {

    val commonMovies = mutableSetOf<String>()

    for (movie in actor1) {
        if (movie in actor2) {
            commonMovies.add(movie)
        }
    }

    return commonMovies
}