/**
 * This function takes in a word and a character. It finds the position(s) of the character in the word
 * using a loop. If the character is found, the function returns the position(s) as a list of integers. If 
 * the character is not found, the function prints "Character not found" and exits the while loop.
 */
fun findCharacter(word: String, character: Char): List<Int>? {

    val positions = mutableListOf<Int>()
    var index = 0
    while (index < word.length) {
        if (word[index] == character) {
            positions.add(index)
        }
        index++
    }

    return if (positions.isNotEmpty()) {
        positions
    } else {
        println("Character not found")
        null
    }
}
/**
 * This function takes in a word and a character. It finds the position(s) of the character in the word
 * using a loop. If the character is found, the function returns the position(s) as a list of integers. If 
 * the character is not found, the function prints "Character not found" and exits the while loop.
 */
fun findCharacter(word: String, character: Char): List<Int>? {
/**
 * This function takes in a word and a character. It finds the position(s) of the character in the word
 * using a loop. If the character is found, the function returns the position(s) as a list of integers. If 
 * the character is not found, the function prints "Character not found" and exits the while loop.
 */
fun findCharacter(word: String, character: Char): List<Int>? {

    val positions = mutableListOf<Int>()
    var index = 0
    while (index < word.length) {
        if (word[index] == character) {
            positions.add(index)
        }
        index++
    }

    return if (positions.isNotEmpty()) {
        positions
    } else {
        println("Character not found")
        null
    }
}