/**
 * Given a string and a character, this function finds all occurrences of the character within the string using a loop.
 *
 * @param string The string in which to search for the character.
 * @param character The character to be found within the string.
 * @return A list containing the indices of all occurrences of the character within the string.
 */
fun findCharacter(string: String, character: Char): List<Int> {

    val indices = mutableListOf<Int>() // Empty list to store the indices
    
    // Loop through each index in the string
    for (i in string.indices) {
        
        // Check if the character at the current index matches the given character
        if (string[i] == character) {
            
            // Append the index to the list
            indices.add(i)
        }
    }
    
    return indices
}
/**
 * Given a string and a character, this function finds all occurrences of the character within the string using a loop.
 *
 * @param string The string in which to search for the character.
 * @param character The character to be found within the string.
 * @return A list containing the indices of all occurrences of the character within the string.
 */
fun findCharacter(string: String, character: Char): List<Int> {
/**
 * Given a string and a character, this function finds all occurrences of the character within the string using a loop.
 *
 * @param string The string in which to search for the character.
 * @param character The character to be found within the string.
 * @return A list containing the indices of all occurrences of the character within the string.
 */
fun findCharacter(string: String, character: Char): List<Int> {

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