/**
 * This function takes in two lists of words and vowels, and returns a list of common words that contain any of the given vowels.
 *
 * @param words a list of strings representing words
 * @param vowels a list of characters representing vowels
 * @return commonWords a list of strings representing common words containing any of the given vowels
 */
fun findCommonWords(words: List<String>, vowels: List<Char>): List<String> {

    val commonWords = mutableListOf<String>()
    val vowelsSet = vowels.toSet()  // Convert vowels list to a set for faster membership checks

    for (word in words) {
        var hasVowel = false
        var i = 0

        while (i < word.length && !hasVowel) {
            if (word[i].toLowerCase() in vowelsSet) {
                hasVowel = true
            }
            i++
        }

        if (hasVowel) {
            commonWords.add(word)
        }
    }

    return commonWords
}
/**
 * This function takes in two lists of words and vowels, and returns a list of common words that contain any of the given vowels.
 *
 * @param words a list of strings representing words
 * @param vowels a list of characters representing vowels
 * @return commonWords a list of strings representing common words containing any of the given vowels
 */
fun findCommonWords(words: List<String>, vowels: List<Char>): List<String> {
/**
 * This function takes in two lists of words and vowels, and returns a list of common words that contain any of the given vowels.
 *
 * @param words a list of strings representing words
 * @param vowels a list of characters representing vowels
 * @return commonWords a list of strings representing common words containing any of the given vowels
 */
fun findCommonWords(words: List<String>, vowels: List<Char>): List<String> {

    val commonWords = mutableListOf<String>()
    val vowelsSet = vowels.toSet()  // Convert vowels list to a set for faster membership checks

    for (word in words) {
        var hasVowel = false
        var i = 0

        while (i < word.length && !hasVowel) {
            if (word[i].toLowerCase() in vowelsSet) {
                hasVowel = true
            }
            i++
        }

        if (hasVowel) {
            commonWords.add(word)
        }
    }

    return commonWords
}