/**
 * Given two words, find the common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): String {

    var commonLetters = ""

    // Initialize index variable
    var i = 0

    // Iterate through each letter in word1
    while (i < word1.length) {
        // Initialize j variable
        var j = 0

        // Check if current letter of word1 is present in word2
        while (j < word2.length) {
            // Compare the letters at respective positions
            if (word1[i] == word2[j]) {
                // If the letter is common, add it to commonLetters
                commonLetters += word1[i]

                // Since we found a common letter, exit the inner loop
                break
            }

            // Increment j to move on to the next letter in word2
            j++
        }

        // Increment i to move on to the next letter in word1
        i++
    }

    return commonLetters
}
/**
 * Given two words, find the common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): String {
/**
 * Given two words, find the common letters between them.
 */
fun findCommonLetters(word1: String, word2: String): String {

    var commonLetters = ""

    // Initialize index variable
    var i = 0

    // Iterate through each letter in word1
    while (i < word1.length) {
        // Initialize j variable
        var j = 0

        // Check if current letter of word1 is present in word2
        while (j < word2.length) {
            // Compare the letters at respective positions
            if (word1[i] == word2[j]) {
                // If the letter is common, add it to commonLetters
                commonLetters += word1[i]

                // Since we found a common letter, exit the inner loop
                break
            }

            // Increment j to move on to the next letter in word2
            j++
        }

        // Increment i to move on to the next letter in word1
        i++
    }

    return commonLetters
}