/**
 * This function takes in a text and a word, and counts the number of times the word appears in the text.
 * The function returns the count.
 *
 * @param text The text to search for the occurrences of the word in.
 * @param word The word to count occurrences of in the text.
 * @return The number of times the word appears in the text.
 */
fun countOccurrences(text: String, word: String): Int {

    var count = 0

    val words = text.split(" ")

    for (i in words.indices) {
        for (j in i until words.size) {
            if (words[j] == word) {
                count++
            }
        }
    }

    return count
}
/**
 * This function takes in a text and a word, and counts the number of times the word appears in the text.
 * The function returns the count.
 *
 * @param text The text to search for the occurrences of the word in.
 * @param word The word to count occurrences of in the text.
 * @return The number of times the word appears in the text.
 */
fun countOccurrences(text: String, word: String): Int {
/**
 * This function takes in a text and a word, and counts the number of times the word appears in the text.
 * The function returns the count.
 *
 * @param text The text to search for the occurrences of the word in.
 * @param word The word to count occurrences of in the text.
 * @return The number of times the word appears in the text.
 */
fun countOccurrences(text: String, word: String): Int {

    var count = 0

    val words = text.split(" ")

    for (i in words.indices) {
        for (j in i until words.size) {
            if (words[j] == word) {
                count++
            }
        }
    }

    return count
}