/**
 * This function takes a list of articles as input and counts the number of words in each article.
 * It then returns a list of dictionaries, each containing the article's title, number of words, and a boolean
 * value indicating if the number of words is greater than or equal to 100.
 */
fun countNumberOfWords(articles: List<Map<String, String>>): List<Map<String, Any>> {

    val wordCountList = mutableListOf<Map<String, Any>>()

    for (article in articles) {
        val title = article["title"] ?: ""
        val content = article["content"] ?: ""
        var wordCount = 0

        for (word in content.split(" ")) {
            wordCount++
        }

        val isGreaterOrEqualTo100 = wordCount >= 100

        val wordCountDict = mapOf(
            "title" to title,
            "word_count" to wordCount,
            "is_greater_or_equal_to_100" to isGreaterOrEqualTo100
        )
        wordCountList.add(wordCountDict)
    }

    return wordCountList
}

// Sample data for testing
val articles = listOf(
    mapOf("title" to "Article 1", "content" to "This is a sample article with more than hundred words."),
    mapOf("title" to "Article 2", "content" to "Another sample article with less than hundred words.")
)
/**
 * This function takes a list of articles as input and counts the number of words in each article.
 * It then returns a list of dictionaries, each containing the article's title, number of words, and a boolean
 * value indicating if the number of words is greater than or equal to 100.
 */
fun countNumberOfWords(articles: List<Map<String, String>>): List<Map<String, Any>> {
/**
 * This function takes a list of articles as input and counts the number of words in each article.
 * It then returns a list of dictionaries, each containing the article's title, number of words, and a boolean
 * value indicating if the number of words is greater than or equal to 100.
 */
fun countNumberOfWords(articles: List<Map<String, String>>): List<Map<String, Any>> {

    val wordCountList = mutableListOf<Map<String, Any>>()

    for (article in articles) {
        val title = article["title"] ?: ""
        val content = article["content"] ?: ""
        var wordCount = 0

        for (word in content.split(" ")) {
            wordCount++
        }

        val isGreaterOrEqualTo100 = wordCount >= 100

        val wordCountDict = mapOf(
            "title" to title,
            "word_count" to wordCount,
            "is_greater_or_equal_to_100" to isGreaterOrEqualTo100
        )
        wordCountList.add(wordCountDict)
    }

    return wordCountList
}

// Sample data for testing
val articles = listOf(
    mapOf("title" to "Article 1", "content" to "This is a sample article with more than hundred words."),
    mapOf("title" to "Article 2", "content" to "Another sample article with less than hundred words.")
)