/**
 * Given an actor/actress name and a list of movies, find the movies in which the actor/actress appeared.
 *
 * @param actor The name of the actor/actress.
 * @param movies A list of movie titles.
 * @return A list of movies in which the actor/actress appeared.
 */
fun findMatchingMovies(actor: String, movies: List<String>): List<String> {

    val matchingMovies = mutableListOf<String>()

    for (movie in movies) {
        if (actor.toLowerCase() in movie.toLowerCase() || "${actor.toLowerCase()} " in movie.toLowerCase()) {
            matchingMovies.add(movie)
        }
    }

    return matchingMovies
}
/**
 * Given an actor/actress name and a list of movies, find the movies in which the actor/actress appeared.
 *
 * @param actor The name of the actor/actress.
 * @param movies A list of movie titles.
 * @return A list of movies in which the actor/actress appeared.
 */
fun findMatchingMovies(actor: String, movies: List<String>): List<String> {
/**
 * Given an actor/actress name and a list of movies, find the movies in which the actor/actress appeared.
 *
 * @param actor The name of the actor/actress.
 * @param movies A list of movie titles.
 * @return A list of movies in which the actor/actress appeared.
 */
fun findMatchingMovies(actor: String, movies: List<String>): List<String> {

    val matchingMovies = mutableListOf<String>()

    for (movie in movies) {
        if (actor.toLowerCase() in movie.toLowerCase() || "${actor.toLowerCase()} " in movie.toLowerCase()) {
            matchingMovies.add(movie)
        }
    }

    return matchingMovies
}