/**
 * This function takes a text and a word as input, and counts the number of occurrences of the word within the text.
 */
fun countWordOccurrences(text: String, word: String) {

    var count = 0
    var lowerCaseText = text.toLowerCase()
    val wordList = lowerCaseText.split(" ")
    val wordOccurrences = mutableMapOf<String, Int>()

    for (currentWord in wordList) {
        if (currentWord == word) {
            count++
            if (wordOccurrences.containsKey(currentWord)) {
                wordOccurrences[currentWord] = wordOccurrences[currentWord]!! + 1
            } else {
                wordOccurrences[currentWord] = 1
            }
        }
    }

    println("Total occurrences of the word '$word': $count")
}
/**
 * This function takes a text and a word as input, and counts the number of occurrences of the word within the text.
 */
fun countWordOccurrences(text: String, word: String) {
/**
 * This function takes a text and a word as input, and counts the number of occurrences of the word within the text.
 */
fun countWordOccurrences(text: String, word: String) {

    var count = 0
    var lowerCaseText = text.toLowerCase()
    val wordList = lowerCaseText.split(" ")
    val wordOccurrences = mutableMapOf<String, Int>()

    for (currentWord in wordList) {
        if (currentWord == word) {
            count++
            if (wordOccurrences.containsKey(currentWord)) {
                wordOccurrences[currentWord] = wordOccurrences[currentWord]!! + 1
            } else {
                wordOccurrences[currentWord] = 1
            }
        }
    }

    println("Total occurrences of the word '$word': $count")
}