/**
 * You are given a list of words. Your task is to count the number of consonants
 * in each word and store the count in a new list. Return the new list with the
 * count of consonants for each word.
 *
 * Example:
 * countConsonants(listOf("geography", "environment", "atmosphere")) ➞ [6, 7, 5]
 *
 * @param words A list of strings (words) to count the consonants of.
 * @return A list of integers representing the count of consonants in each word.
 */
fun countConsonants(words: List<String>): List<Int> {

    val consonantCount = mutableListOf<Int>()
    for (word in words) {
        var count = 0
        for (char in word) {
            if (char.toLowerCase() !in listOf('a', 'e', 'i', 'o', 'u') && char.isLetter()) {
                count++
            }
        }
        consonantCount.add(count)
    }
    return consonantCount
}
/**
 * You are given a list of words. Your task is to count the number of consonants
 * in each word and store the count in a new list. Return the new list with the
 * count of consonants for each word.
 *
 * Example:
 * countConsonants(listOf("geography", "environment", "atmosphere")) ➞ [6, 7, 5]
 *
 * @param words A list of strings (words) to count the consonants of.
 * @return A list of integers representing the count of consonants in each word.
 */
fun countConsonants(words: List<String>): List<Int> {
/**
 * You are given a list of words. Your task is to count the number of consonants
 * in each word and store the count in a new list. Return the new list with the
 * count of consonants for each word.
 *
 * Example:
 * countConsonants(listOf("geography", "environment", "atmosphere")) ➞ [6, 7, 5]
 *
 * @param words A list of strings (words) to count the consonants of.
 * @return A list of integers representing the count of consonants in each word.
 */
fun countConsonants(words: List<String>): List<Int> {

    val consonantCount = mutableListOf<Int>()
    for (word in words) {
        var count = 0
        for (char in word) {
            if (char.toLowerCase() !in listOf('a', 'e', 'i', 'o', 'u') && char.isLetter()) {
                count++
            }
        }
        consonantCount.add(count)
    }
    return consonantCount
}