/**
 * This function takes a list of articles (represented as nested tuples) and a list of keywords.
 * It returns a list of articles that contain all the specified keywords.
 *
 * @param articles A tuple of articles, where each article is represented as a tuple of title, publication, and content.
 * @param keywords A list of keywords to search for in the articles.
 * @return A list of articles that contain all the specified keywords.
 */
fun findArticles(articles: List<Triple<String, String, String>>, keywords: List<String>): List<Triple<String, String, String>> {

    val result = mutableListOf<Triple<String, String, String>>()

    for (article in articles) {
        val (title, publication, content) = article

        var keywordCount = 0

        for (word in keywords) {
            if (word in title.toLowerCase() || word in publication.toLowerCase() || word in content.toLowerCase()) {
                keywordCount++
            }
        }

        if (keywordCount == keywords.size) {
            result.add(article)
        }
    }

    return result
}

val articles = listOf(
    Triple("Breaking News: Earthquake strikes in California", "The Times", "A major earthquake measuring 7.0 on the Richter scale struck California today."),
    Triple("New Study Reveals Alarming Rise in Pollution Levels", "Daily News", "A recent study conducted by environmental scientists")
)
/**
 * This function takes a list of articles (represented as nested tuples) and a list of keywords.
 * It returns a list of articles that contain all the specified keywords.
 *
 * @param articles A tuple of articles, where each article is represented as a tuple of title, publication, and content.
 * @param keywords A list of keywords to search for in the articles.
 * @return A list of articles that contain all the specified keywords.
 */
fun findArticles(articles: List<Triple<String, String, String>>, keywords: List<String>): List<Triple<String, String, String>> {
/**
 * This function takes a list of articles (represented as nested tuples) and a list of keywords.
 * It returns a list of articles that contain all the specified keywords.
 *
 * @param articles A tuple of articles, where each article is represented as a tuple of title, publication, and content.
 * @param keywords A list of keywords to search for in the articles.
 * @return A list of articles that contain all the specified keywords.
 */
fun findArticles(articles: List<Triple<String, String, String>>, keywords: List<String>): List<Triple<String, String, String>> {

    val result = mutableListOf<Triple<String, String, String>>()

    for (article in articles) {
        val (title, publication, content) = article

        var keywordCount = 0

        for (word in keywords) {
            if (word in title.toLowerCase() || word in publication.toLowerCase() || word in content.toLowerCase()) {
                keywordCount++
            }
        }

        if (keywordCount == keywords.size) {
            result.add(article)
        }
    }

    return result
}

val articles = listOf(
    Triple("Breaking News: Earthquake strikes in California", "The Times", "A major earthquake measuring 7.0 on the Richter scale struck California today."),
    Triple("New Study Reveals Alarming Rise in Pollution Levels", "Daily News", "A recent study conducted by environmental scientists")
)