/**
 * This function takes a string and a character as input, and returns the number
 * of times the character appears in the string using loops.
 *
 * @param string A string in which to count occurrences of the character.
 * @param char A character to be found in the string.
 * @return An integer representing the number of times the character appears in the string.
 */
fun countOccurrences(string: String, char: Char): Int {

    var count = 0

    // Loop through each character in the string
    for (i in string.indices) {
        // Check if the character at current index matches the given character
        if (string[i] == char) {
            count++
        }
    }

    return count
}
/**
 * This function takes a string and a character as input, and returns the number
 * of times the character appears in the string using loops.
 *
 * @param string A string in which to count occurrences of the character.
 * @param char A character to be found in the string.
 * @return An integer representing the number of times the character appears in the string.
 */
fun countOccurrences(string: String, char: Char): Int {
/**
 * This function takes a string and a character as input, and returns the number
 * of times the character appears in the string using loops.
 *
 * @param string A string in which to count occurrences of the character.
 * @param char A character to be found in the string.
 * @return An integer representing the number of times the character appears in the string.
 */
fun countOccurrences(string: String, char: Char): Int {

    var count = 0

    // Loop through each character in the string
    for (i in string.indices) {
        // Check if the character at current index matches the given character
        if (string[i] == char) {
            count++
        }
    }

    return count
}