/**
 * This function finds the common words present in the titles of given articles.
 *
 * @param articles A list of articles as tuples in the format (title, published_date)
 * @return A set of common words found in the titles of articles
 */
fun findCommonWords(articles: List<Pair<String, String>>): Set<String> {

    val commonWords = mutableSetOf<String>()

    for ((title, _) in articles) {
        val words = title.split(" ")

        if (commonWords.isEmpty()) {
            commonWords.addAll(words)
        } else {
            commonWords.retainAll(words)
        }
    }

    return commonWords
}
/**
 * This function finds the common words present in the titles of given articles.
 *
 * @param articles A list of articles as tuples in the format (title, published_date)
 * @return A set of common words found in the titles of articles
 */
fun findCommonWords(articles: List<Pair<String, String>>): Set<String> {
/**
 * This function finds the common words present in the titles of given articles.
 *
 * @param articles A list of articles as tuples in the format (title, published_date)
 * @return A set of common words found in the titles of articles
 */
fun findCommonWords(articles: List<Pair<String, String>>): Set<String> {

    val commonWords = mutableSetOf<String>()

    for ((title, _) in articles) {
        val words = title.split(" ")

        if (commonWords.isEmpty()) {
            commonWords.addAll(words)
        } else {
            commonWords.retainAll(words)
        }
    }

    return commonWords
}