/**
 * Write a function to count the number of movies for each year an actor/actress has acted in.
 * The function should take a dictionary, where the keys are the years and the values are lists of movie titles.
 * The function should return a new dictionary, where the keys are the years and the values are the count of movies for that year.
 *
 * @param actor A dictionary containing the years as keys and lists of movie titles as values.
 * @return A dictionary containing the years as keys and the count of movies for that year as values.
 */
fun countMovies(actor: Map<Int, List<String>>): Map<Int, Int> {

    val movieCounts = mutableMapOf<Int, Int>()  // Creating an empty dictionary to store movie counts

    // Iterating over each year in the given actor's dictionary
    for ((year, movies) in actor) {
        var count = 0  // Initializing a count variable

        // Iterating over each movie title in the list of movie titles for a particular year
        for (movie in movies) {
            count++  // Incrementing the count for each movie title
        }

        movieCounts[year] = count  // Assigning the count to the corresponding year in the movieCounts dictionary
    }

    return movieCounts
}
/**
 * Write a function to count the number of movies for each year an actor/actress has acted in.
 * The function should take a dictionary, where the keys are the years and the values are lists of movie titles.
 * The function should return a new dictionary, where the keys are the years and the values are the count of movies for that year.
 *
 * @param actor A dictionary containing the years as keys and lists of movie titles as values.
 * @return A dictionary containing the years as keys and the count of movies for that year as values.
 */
fun countMovies(actor: Map<Int, List<String>>): Map<Int, Int> {
/**
 * Write a function to count the number of movies for each year an actor/actress has acted in.
 * The function should take a dictionary, where the keys are the years and the values are lists of movie titles.
 * The function should return a new dictionary, where the keys are the years and the values are the count of movies for that year.
 *
 * @param actor A dictionary containing the years as keys and lists of movie titles as values.
 * @return A dictionary containing the years as keys and the count of movies for that year as values.
 */
fun countMovies(actor: Map<Int, List<String>>): Map<Int, Int> {

    val movieCounts = mutableMapOf<Int, Int>()  // Creating an empty dictionary to store movie counts

    // Iterating over each year in the given actor's dictionary
    for ((year, movies) in actor) {
        var count = 0  // Initializing a count variable

        // Iterating over each movie title in the list of movie titles for a particular year
        for (movie in movies) {
            count++  // Incrementing the count for each movie title
        }

        movieCounts[year] = count  // Assigning the count to the corresponding year in the movieCounts dictionary
    }

    return movieCounts
}