/**
 * This function takes a string and a character as input and returns a list of indices
 * where the character is found in the string using loops.
 *
 * @param string The input string
 * @param character The character to find in the string
 * @return A list of indices where the character is found in the string
 *
 * Example:
 * findCharacterIndices("hello world", 'l') // [2, 3, 9]
 */
fun findCharacterIndices(string: String, character: Char): List<Int> {

    val indices = mutableListOf<Int>()
    // Loop through each character in the string
    for (i in string.indices) {
        // Check if the current character is equal to the given character
        if (string[i] == character) {
            // Append the index of the character to the list
            indices.add(i)
        }
    }
    return indices
}
/**
 * This function takes a string and a character as input and returns a list of indices
 * where the character is found in the string using loops.
 *
 * @param string The input string
 * @param character The character to find in the string
 * @return A list of indices where the character is found in the string
 *
 * Example:
 * findCharacterIndices("hello world", 'l') // [2, 3, 9]
 */
fun findCharacterIndices(string: String, character: Char): List<Int> {
/**
 * This function takes a string and a character as input and returns a list of indices
 * where the character is found in the string using loops.
 *
 * @param string The input string
 * @param character The character to find in the string
 * @return A list of indices where the character is found in the string
 *
 * Example:
 * findCharacterIndices("hello world", 'l') // [2, 3, 9]
 */
fun findCharacterIndices(string: String, character: Char): List<Int> {

    val indices = mutableListOf<Int>()
    // Loop through each character in the string
    for (i in string.indices) {
        // Check if the current character is equal to the given character
        if (string[i] == character) {
            // Append the index of the character to the list
            indices.add(i)
        }
    }
    return indices
}