/**
 * Given a string and a list of vowels, count the occurrences of each vowel in the string using loops.
 *
 * @param string The input string where we need to find vowel occurrences.
 * @param vowels The list of vowels.
 * @return A dictionary containing the count of occurrences for each vowel in the string.
 */
fun countVowelOccurrences(string: String, vowels: List<Char>): Map<Char, Int> {

    val occurrences = mutableMapOf<Char, Int>()  // initialize an empty dictionary to store vowel occurrences

    for (vowel in vowels) {
        var count = 0  // initialize the count of a vowel to 0

        // iterate through each character in the string
        for (char in string) {
            if (char.toLowerCase() == vowel) {  // check if the character is equal to the vowel
                count++  // increment the count if it's a match
            }
        }

        occurrences[vowel] = count  // store the count in the dictionary
    }

    return occurrences
}
/**
 * Given a string and a list of vowels, count the occurrences of each vowel in the string using loops.
 *
 * @param string The input string where we need to find vowel occurrences.
 * @param vowels The list of vowels.
 * @return A dictionary containing the count of occurrences for each vowel in the string.
 */
fun countVowelOccurrences(string: String, vowels: List<Char>): Map<Char, Int> {
/**
 * Given a string and a list of vowels, count the occurrences of each vowel in the string using loops.
 *
 * @param string The input string where we need to find vowel occurrences.
 * @param vowels The list of vowels.
 * @return A dictionary containing the count of occurrences for each vowel in the string.
 */
fun countVowelOccurrences(string: String, vowels: List<Char>): Map<Char, Int> {

    val occurrences = mutableMapOf<Char, Int>()  // initialize an empty dictionary to store vowel occurrences

    for (vowel in vowels) {
        var count = 0  // initialize the count of a vowel to 0

        // iterate through each character in the string
        for (char in string) {
            if (char.toLowerCase() == vowel) {  // check if the character is equal to the vowel
                count++  // increment the count if it's a match
            }
        }

        occurrences[vowel] = count  // store the count in the dictionary
    }

    return occurrences
}