/**
 * This function takes a text string and a word as input, and returns a list containing indices of the word's occurrences in the text.
 */
fun findWordIndex(text: String, word: String): List<Int> {

    // Initialize an empty list to store the indices
    val indices = mutableListOf<Int>()
    
    // Use a loop to iterate over each character in the text
    // and check if the current character is the start of the word
    for (i in 0 until text.length - word.length + 1) {
        if (text.substring(i, i + word.length) == word) {
            indices.add(i)
        }
    }
    
    return indices
}
/**
 * This function takes a text string and a word as input, and returns a list containing indices of the word's occurrences in the text.
 */
fun findWordIndex(text: String, word: String): List<Int> {
/**
 * This function takes a text string and a word as input, and returns a list containing indices of the word's occurrences in the text.
 */
fun findWordIndex(text: String, word: String): List<Int> {

    // Initialize an empty list to store the indices
    val indices = mutableListOf<Int>()
    
    // Use a loop to iterate over each character in the text
    // and check if the current character is the start of the word
    for (i in 0 until text.length - word.length + 1) {
        if (text.substring(i, i + word.length) == word) {
            indices.add(i)
        }
    }
    
    return indices
}