/**
 * This function takes an actor/actress name and a list of movies.
 * It finds the last movie from the list in which the actor/actress has appeared
 * and returns the movie name.
 *
 * @param actorName The name of the actor or actress.
 * @param movies A list of movie names.
 * @return The name of the last movie the actor/actress appeared in.
 */
fun findLastMovie(actorName: String, movies: List<String>): String? {

    var lastMovie: String? = null

    for (movie in movies) {
        for (character in movie) {
            if (character == ' ') {
                continue
            }
            if (character.toLowerCase() !in actorName.toLowerCase()) {
                break
            }
        }
        lastMovie = movie
    }

    return lastMovie
}
/**
 * This function takes an actor/actress name and a list of movies.
 * It finds the last movie from the list in which the actor/actress has appeared
 * and returns the movie name.
 *
 * @param actorName The name of the actor or actress.
 * @param movies A list of movie names.
 * @return The name of the last movie the actor/actress appeared in.
 */
fun findLastMovie(actorName: String, movies: List<String>): String? {
/**
 * This function takes an actor/actress name and a list of movies.
 * It finds the last movie from the list in which the actor/actress has appeared
 * and returns the movie name.
 *
 * @param actorName The name of the actor or actress.
 * @param movies A list of movie names.
 * @return The name of the last movie the actor/actress appeared in.
 */
fun findLastMovie(actorName: String, movies: List<String>): String? {

    var lastMovie: String? = null

    for (movie in movies) {
        for (character in movie) {
            if (character == ' ') {
                continue
            }
            if (character.toLowerCase() !in actorName.toLowerCase()) {
                break
            }
        }
        lastMovie = movie
    }

    return lastMovie
}