/**
 * This function takes a list of articles and a set of keywords and returns a set of common words 
 * present in all the articles, using unconditioned ternary operator.
 *
 * @param articles A list of articles as strings.
 * @param keywords A set of keywords as strings.
 * @return A set of common words present in all the articles.
 */
fun findCommonWords(articles: List<String>, keywords: Set<String>): Set<String> {

    var commonWords = mutableSetOf<String>()

    // Iterate over each article
    for (article in articles) {
        // Split the article into words
        val words = article.split(" ").toSet()

        // Calculate the intersection of current article words and keywords set using ternary operator
        commonWords = if (commonWords.isEmpty()) words.toMutableSet() else commonWords.intersect(words).toMutableSet()
    }

    return commonWords
}
/**
 * This function takes a list of articles and a set of keywords and returns a set of common words 
 * present in all the articles, using unconditioned ternary operator.
 *
 * @param articles A list of articles as strings.
 * @param keywords A set of keywords as strings.
 * @return A set of common words present in all the articles.
 */
fun findCommonWords(articles: List<String>, keywords: Set<String>): Set<String> {
/**
 * This function takes a list of articles and a set of keywords and returns a set of common words 
 * present in all the articles, using unconditioned ternary operator.
 *
 * @param articles A list of articles as strings.
 * @param keywords A set of keywords as strings.
 * @return A set of common words present in all the articles.
 */
fun findCommonWords(articles: List<String>, keywords: Set<String>): Set<String> {

    var commonWords = mutableSetOf<String>()

    // Iterate over each article
    for (article in articles) {
        // Split the article into words
        val words = article.split(" ").toSet()

        // Calculate the intersection of current article words and keywords set using ternary operator
        commonWords = if (commonWords.isEmpty()) words.toMutableSet() else commonWords.intersect(words).toMutableSet()
    }

    return commonWords
}