/**
 * Given two articles, find the common words in their headlines.
 *
 * @param article1 A list containing the headline words of the first article.
 * @param article2 A list containing the headline words of the second article.
 * @return A list containing the common words between both articles' headlines.
 *
 * Example:
 * article1 = listOf("Python", "Programming", "for", "Beginners")
 * article2 = listOf("Python", "Programming", "is", "Awesome")
 * findCommonWords(article1, article2) // Output: ["Python", "Programming"]
 */
fun findCommonWords(article1: List<String>, article2: List<String>): List<String> {

    val commonWords = mutableListOf<String>()
    
    // Iterate through each word in the first article
    for (word in article1) {
        // Check if the word is also present in the second article
        if (word in article2) {
            // Add the common word to the list
            commonWords.add(word)
        }
    }
    
    return commonWords
}
/**
 * Given two articles, find the common words in their headlines.
 *
 * @param article1 A list containing the headline words of the first article.
 * @param article2 A list containing the headline words of the second article.
 * @return A list containing the common words between both articles' headlines.
 *
 * Example:
 * article1 = listOf("Python", "Programming", "for", "Beginners")
 * article2 = listOf("Python", "Programming", "is", "Awesome")
 * findCommonWords(article1, article2) // Output: ["Python", "Programming"]
 */
fun findCommonWords(article1: List<String>, article2: List<String>): List<String> {
/**
 * Given two articles, find the common words in their headlines.
 *
 * @param article1 A list containing the headline words of the first article.
 * @param article2 A list containing the headline words of the second article.
 * @return A list containing the common words between both articles' headlines.
 *
 * Example:
 * article1 = listOf("Python", "Programming", "for", "Beginners")
 * article2 = listOf("Python", "Programming", "is", "Awesome")
 * findCommonWords(article1, article2) // Output: ["Python", "Programming"]
 */
fun findCommonWords(article1: List<String>, article2: List<String>): List<String> {

    val commonWords = mutableListOf<String>()
    
    // Iterate through each word in the first article
    for (word in article1) {
        // Check if the word is also present in the second article
        if (word in article2) {
            // Add the common word to the list
            commonWords.add(word)
        }
    }
    
    return commonWords
}