/**
 * You are given a dictionary where the keys are words and the values are the number of times the word appears in a text. Your task is to write a function that counts the total number of words in the text.
 *
 * @param text A dictionary where the keys are words and the values are the number of times the word appears in the text.
 * @return The total number of words in the text.
 *
 * Example:
 * countWords(mapOf("the" to 3, "news" to 2, "is" to 1, "important" to 1)) -> 7
 */
fun countWords(text: Map<String, Int>): Int {

    var totalWords = 0
    
    // Loop through the dictionary and add up the values (word counts)
    for (wordCount in text.values) {
        totalWords += wordCount
    }

    return totalWords
}
/**
 * You are given a dictionary where the keys are words and the values are the number of times the word appears in a text. Your task is to write a function that counts the total number of words in the text.
 *
 * @param text A dictionary where the keys are words and the values are the number of times the word appears in the text.
 * @return The total number of words in the text.
 *
 * Example:
 * countWords(mapOf("the" to 3, "news" to 2, "is" to 1, "important" to 1)) -> 7
 */
fun countWords(text: Map<String, Int>): Int {
/**
 * You are given a dictionary where the keys are words and the values are the number of times the word appears in a text. Your task is to write a function that counts the total number of words in the text.
 *
 * @param text A dictionary where the keys are words and the values are the number of times the word appears in the text.
 * @return The total number of words in the text.
 *
 * Example:
 * countWords(mapOf("the" to 3, "news" to 2, "is" to 1, "important" to 1)) -> 7
 */
fun countWords(text: Map<String, Int>): Int {

    var totalWords = 0
    
    // Loop through the dictionary and add up the values (word counts)
    for (wordCount in text.values) {
        totalWords += wordCount
    }

    return totalWords
}