/**
 * This function takes in two words as arguments and returns a list of common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {

    // Initialize an empty list to store common letters
    val commonLetters = mutableListOf<Char>()

    // Convert the words to lowercase for comparison
    val lowerWord1 = word1.toLowerCase()
    val lowerWord2 = word2.toLowerCase()

    // Use a while loop to iterate through each character in word1
    var i = 0
    while (i < lowerWord1.length) {
        val letter = lowerWord1[i]

        // Use a for loop to iterate through each character in word2
        for (j in lowerWord2.indices) {
            if (letter == lowerWord2[j]) {
                // Add the common letter to the list
                commonLetters.add(letter)
                break
            }
        }

        // Increment the index to check the next character in word1
        i++
    }

    return commonLetters
}
/**
 * This function takes in two words as arguments and returns a list of common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {
/**
 * This function takes in two words as arguments and returns a list of common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): List<Char> {

    // Initialize an empty list to store common letters
    val commonLetters = mutableListOf<Char>()

    // Convert the words to lowercase for comparison
    val lowerWord1 = word1.toLowerCase()
    val lowerWord2 = word2.toLowerCase()

    // Use a while loop to iterate through each character in word1
    var i = 0
    while (i < lowerWord1.length) {
        val letter = lowerWord1[i]

        // Use a for loop to iterate through each character in word2
        for (j in lowerWord2.indices) {
            if (letter == lowerWord2[j]) {
                // Add the common letter to the list
                commonLetters.add(letter)
                break
            }
        }

        // Increment the index to check the next character in word1
        i++
    }

    return commonLetters
}