/**
 * Given two strings, word1 and word2, this function finds and returns a list of common letters
 * between the two strings. If there are no common letters, an empty list is returned.
 * Example: findCommonLetters("hello", "world") -> ['l', 'o']
 *
 * @param word1 The first input string
 * @param word2 The second input string
 * @return A list of common letters between word1 and word2
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {

    val commonLetters = mutableListOf<Char>()

    for (letter1 in word1) {
        if (letter1 !in commonLetters) {
            for (letter2 in word2) {
                if (letter1 == letter2 && letter1 !in commonLetters) {
                    commonLetters.add(letter1)
                    break
                }
            }
        }
    }

    return commonLetters
}
/**
 * Given two strings, word1 and word2, this function finds and returns a list of common letters
 * between the two strings. If there are no common letters, an empty list is returned.
 * Example: findCommonLetters("hello", "world") -> ['l', 'o']
 *
 * @param word1 The first input string
 * @param word2 The second input string
 * @return A list of common letters between word1 and word2
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {
/**
 * Given two strings, word1 and word2, this function finds and returns a list of common letters
 * between the two strings. If there are no common letters, an empty list is returned.
 * Example: findCommonLetters("hello", "world") -> ['l', 'o']
 *
 * @param word1 The first input string
 * @param word2 The second input string
 * @return A list of common letters between word1 and word2
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {

    val commonLetters = mutableListOf<Char>()

    for (letter1 in word1) {
        if (letter1 !in commonLetters) {
            for (letter2 in word2) {
                if (letter1 == letter2 && letter1 !in commonLetters) {
                    commonLetters.add(letter1)
                    break
                }
            }
        }
    }

    return commonLetters
}