/**
 * Given a dictionary 'movies' containing movie titles as keys and the actors/actresses in them as values,
 * append the movies in which the actor has acted to an empty list 'actorMovies' and return it.
 *
 * @param actor Name of the actor/actress.
 * @param movies Dictionary containing movies and actors/actresses.
 * @return List of movies in which the actor has acted.
 */
fun appendActorMovies(actor: String, movies: Map<String, List<String>>): List<String> {

    val actorMovies = mutableListOf<String>()
    for ((movie, actors) in movies) {
        if (actor in actors) {
            actorMovies.add(movie)
        }
    }
    return actorMovies
}
/**
 * Given a dictionary 'movies' containing movie titles as keys and the actors/actresses in them as values,
 * append the movies in which the actor has acted to an empty list 'actorMovies' and return it.
 *
 * @param actor Name of the actor/actress.
 * @param movies Dictionary containing movies and actors/actresses.
 * @return List of movies in which the actor has acted.
 */
fun appendActorMovies(actor: String, movies: Map<String, List<String>>): List<String> {
/**
 * Given a dictionary 'movies' containing movie titles as keys and the actors/actresses in them as values,
 * append the movies in which the actor has acted to an empty list 'actorMovies' and return it.
 *
 * @param actor Name of the actor/actress.
 * @param movies Dictionary containing movies and actors/actresses.
 * @return List of movies in which the actor has acted.
 */
fun appendActorMovies(actor: String, movies: Map<String, List<String>>): List<String> {

    val actorMovies = mutableListOf<String>()
    for ((movie, actors) in movies) {
        if (actor in actors) {
            actorMovies.add(movie)
        }
    }
    return actorMovies
}