/**
 * Given a string and a character, this function finds all the indices
 * at which the character appears in the string using loops and nested indexing.
 *
 * @param string The input string.
 * @param char The character to find in the string.
 * @return A list containing the indices at which the character appears in the string.
 */
fun findCharacter(string: String, char: Char): List<Int> {

    val indices = mutableListOf<Int>()
    var index = 0
    val length = string.length

    while (index < length) {
        if (string[index] == char) {
            indices.add(index)
        }
        index++
    }

    return indices
}
/**
 * Given a string and a character, this function finds all the indices
 * at which the character appears in the string using loops and nested indexing.
 *
 * @param string The input string.
 * @param char The character to find in the string.
 * @return A list containing the indices at which the character appears in the string.
 */
fun findCharacter(string: String, char: Char): List<Int> {
/**
 * Given a string and a character, this function finds all the indices
 * at which the character appears in the string using loops and nested indexing.
 *
 * @param string The input string.
 * @param char The character to find in the string.
 * @return A list containing the indices at which the character appears in the string.
 */
fun findCharacter(string: String, char: Char): List<Int> {

    val indices = mutableListOf<Int>()
    var index = 0
    val length = string.length

    while (index < length) {
        if (string[index] == char) {
            indices.add(index)
        }
        index++
    }

    return indices
}