/**
 * This function filters a list of news articles based on a given topic.
 *
 * @param articles a list of news articles (each article represented as a map)
 * @param topic a string representing the topic to filter the articles
 * @return filtered_articles a list of news articles matching the given topic
 *
 * Example:
 * Input:
 * articles = listOf(
 *     mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"),
 *     mapOf("title" to "Global leaders meet to discuss climate change", "topic" to "environment"),
 *     mapOf("title" to "Research shows benefits of exercise", "topic" to "health"),
 *     mapOf("title" to "New book release becomes instant bestseller", "topic" to "literature")
 * )
 *
 * topic = "technology"
 *
 * Output:
 * filtered_articles = listOf(mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"))
 */
fun filterNewsArticles(articles: List<Map<String, String>>, topic: String): List<Map<String, String>> {

    return articles.filter { it["topic"] == topic }
}
/**
 * This function filters a list of news articles based on a given topic.
 *
 * @param articles a list of news articles (each article represented as a map)
 * @param topic a string representing the topic to filter the articles
 * @return filtered_articles a list of news articles matching the given topic
 *
 * Example:
 * Input:
 * articles = listOf(
 *     mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"),
 *     mapOf("title" to "Global leaders meet to discuss climate change", "topic" to "environment"),
 *     mapOf("title" to "Research shows benefits of exercise", "topic" to "health"),
 *     mapOf("title" to "New book release becomes instant bestseller", "topic" to "literature")
 * )
 *
 * topic = "technology"
 *
 * Output:
 * filtered_articles = listOf(mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"))
 */
fun filterNewsArticles(articles: List<Map<String, String>>, topic: String): List<Map<String, String>> {
/**
 * This function filters a list of news articles based on a given topic.
 *
 * @param articles a list of news articles (each article represented as a map)
 * @param topic a string representing the topic to filter the articles
 * @return filtered_articles a list of news articles matching the given topic
 *
 * Example:
 * Input:
 * articles = listOf(
 *     mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"),
 *     mapOf("title" to "Global leaders meet to discuss climate change", "topic" to "environment"),
 *     mapOf("title" to "Research shows benefits of exercise", "topic" to "health"),
 *     mapOf("title" to "New book release becomes instant bestseller", "topic" to "literature")
 * )
 *
 * topic = "technology"
 *
 * Output:
 * filtered_articles = listOf(mapOf("title" to "Tech giants announce new product releases", "topic" to "technology"))
 */
fun filterNewsArticles(articles: List<Map<String, String>>, topic: String): List<Map<String, String>> {

    return articles.filter { it["topic"] == topic }
}