/**
 * Given a character 'char' and a string 'text', this function returns the number of occurrences
 * of 'char' in 'text'.
 *
 * @param char The character to be counted.
 * @param text The string in which the character is to be counted.
 * @return The number of occurrences of the character in the string.
 */
fun countOccurrences(char: Char, text: String): Int {

    var count = 0  // Variable to store the count of occurrences

    for (letter in text) {  // Loop through each character in the text
        if (letter == char) {  // Check if the character matches the given character
            count++  // Increment the count if a match is found
        }
    }

    return count
}

// Exercise:
// Write a function that takes a list of strings and returns the total number of occurrences
// of the character 'a' in the strings. If there are no strings in the list, return 0.
/**
 * Given a character 'char' and a string 'text', this function returns the number of occurrences
 * of 'char' in 'text'.
 *
 * @param char The character to be counted.
 * @param text The string in which the character is to be counted.
 * @return The number of occurrences of the character in the string.
 */
fun countOccurrences(char: Char, text: String): Int {
/**
 * Given a character 'char' and a string 'text', this function returns the number of occurrences
 * of 'char' in 'text'.
 *
 * @param char The character to be counted.
 * @param text The string in which the character is to be counted.
 * @return The number of occurrences of the character in the string.
 */
fun countOccurrences(char: Char, text: String): Int {

    var count = 0  // Variable to store the count of occurrences

    for (letter in text) {  // Loop through each character in the text
        if (letter == char) {  // Check if the character matches the given character
            count++  // Increment the count if a match is found
        }
    }

    return count
}

// Exercise:
// Write a function that takes a list of strings and returns the total number of occurrences
// of the character 'a' in the strings. If there are no strings in the list, return 0.