/**
 * This exercise is designed for a Psychologist to practice using an else statement
 * within a for loop when working with strings. The task is to find matching letters
 * between two words and return a list of those letters in the order they appear in the
 * first word. If there are no matching letters, an empty list should be returned.
 *
 * @param word1 The first word to compare.
 * @param word2 The second word to compare.
 * @return A list of matching letters in the order they appear in word1.
 */
fun findMatchingWords(word1: String, word2: String): List<Char> {

    val matchingLetters = mutableListOf<Char>()

    for (letter in word1) {
        if (letter in word2) {
            matchingLetters.add(letter)
        } else {
            // TODO: Replace this else block with appropriate code
        }
    }

    return matchingLetters
}
/**
 * This exercise is designed for a Psychologist to practice using an else statement
 * within a for loop when working with strings. The task is to find matching letters
 * between two words and return a list of those letters in the order they appear in the
 * first word. If there are no matching letters, an empty list should be returned.
 *
 * @param word1 The first word to compare.
 * @param word2 The second word to compare.
 * @return A list of matching letters in the order they appear in word1.
 */
fun findMatchingWords(word1: String, word2: String): List<Char> {
/**
 * This exercise is designed for a Psychologist to practice using an else statement
 * within a for loop when working with strings. The task is to find matching letters
 * between two words and return a list of those letters in the order they appear in the
 * first word. If there are no matching letters, an empty list should be returned.
 *
 * @param word1 The first word to compare.
 * @param word2 The second word to compare.
 * @return A list of matching letters in the order they appear in word1.
 */
fun findMatchingWords(word1: String, word2: String): List<Char> {

    val matchingLetters = mutableListOf<Char>()

    for (letter in word1) {
        if (letter in word2) {
            matchingLetters.add(letter)
        } else {
            // TODO: Replace this else block with appropriate code
        }
    }

    return matchingLetters
}