/**
 * Given a list of words and a pattern, find all the words from the list that contain the pattern.
 *
 * @param words a list of strings
 * @param pattern a string
 * @return a list of matching words from the input list
 */
fun findMatchingWords(words: List<String>, pattern: String): List<String> {

    val matchingWords = mutableListOf<String>()

    for (word in words) {
        if (pattern in word) {
            matchingWords.add(word)
        }
    }

    return matchingWords
}
/**
 * Given a list of words and a pattern, find all the words from the list that contain the pattern.
 *
 * @param words a list of strings
 * @param pattern a string
 * @return a list of matching words from the input list
 */
fun findMatchingWords(words: List<String>, pattern: String): List<String> {
/**
 * Given a list of words and a pattern, find all the words from the list that contain the pattern.
 *
 * @param words a list of strings
 * @param pattern a string
 * @return a list of matching words from the input list
 */
fun findMatchingWords(words: List<String>, pattern: String): List<String> {

    val matchingWords = mutableListOf<String>()

    for (word in words) {
        if (pattern in word) {
            matchingWords.add(word)
        }
    }

    return matchingWords
}