/**
 * The function takes two actor/actress names as input and finds the common movies they have worked on.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @return A list of common movies the two actors/actresses have worked on.
 */
fun findCommonMovies(actor1: String, actor2: String): List<String> {

    // Sample movie database
    val movieDatabase = mapOf(
        "Tom Hanks" to listOf("Forest Gump", "Saving Private Ryan", "Toy Story"),
        "Meryl Streep" to listOf("The Devil Wears Prada", "Mamma Mia", "Julie & Julia"),
        "Leonardo DiCaprio" to listOf("Titanic", "The Wolf of Wall Street", "Inception"),
        "Johnny Depp" to listOf("Pirates of the Caribbean", "Edward Scissorhands", "Alice in Wonderland")
    )

    // Check if the actors are present in the movie database
    if (!movieDatabase.containsKey(actor1)) {
        return listOf("$actor1 is not found in the movie database.")
    }
    if (!movieDatabase.containsKey(actor2)) {
        return listOf("$actor2 is not found in the movie database.")
    }

    // Find common movies
    val commonMovies = movieDatabase[actor1]!!.intersect(movieDatabase[actor2]!!).toList()
    return commonMovies
}
/**
 * The function takes two actor/actress names as input and finds the common movies they have worked on.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @return A list of common movies the two actors/actresses have worked on.
 */
fun findCommonMovies(actor1: String, actor2: String): List<String> {
/**
 * The function takes two actor/actress names as input and finds the common movies they have worked on.
 *
 * @param actor1 Name of the first actor/actress.
 * @param actor2 Name of the second actor/actress.
 * @return A list of common movies the two actors/actresses have worked on.
 */
fun findCommonMovies(actor1: String, actor2: String): List<String> {

    // Sample movie database
    val movieDatabase = mapOf(
        "Tom Hanks" to listOf("Forest Gump", "Saving Private Ryan", "Toy Story"),
        "Meryl Streep" to listOf("The Devil Wears Prada", "Mamma Mia", "Julie & Julia"),
        "Leonardo DiCaprio" to listOf("Titanic", "The Wolf of Wall Street", "Inception"),
        "Johnny Depp" to listOf("Pirates of the Caribbean", "Edward Scissorhands", "Alice in Wonderland")
    )

    // Check if the actors are present in the movie database
    if (!movieDatabase.containsKey(actor1)) {
        return listOf("$actor1 is not found in the movie database.")
    }
    if (!movieDatabase.containsKey(actor2)) {
        return listOf("$actor2 is not found in the movie database.")
    }

    // Find common movies
    val commonMovies = movieDatabase[actor1]!!.intersect(movieDatabase[actor2]!!).toList()
    return commonMovies
}