/**
 * Given two strings, find the common letters and return a list.
 *
 * @param string1 The first input string.
 * @param string2 The second input string.
 * @return A list containing the common letters found.
 */
fun printCommonLetters(string1: String, string2: String): List<Char> {

    val commonLetters = mutableListOf<Char>()

    // Nested loop to iterate through each character of both strings
    for (char1 in string1) {
        for (char2 in string2) {
            // If the characters match and are not already in the commonLetters list
            if (char1 == char2 && char1 !in commonLetters) {
                commonLetters.add(char1)
            }
        }
    }

    // Sort and return the commonLetters list
    return commonLetters.sorted()
}
/**
 * Given two strings, find the common letters and return a list.
 *
 * @param string1 The first input string.
 * @param string2 The second input string.
 * @return A list containing the common letters found.
 */
fun printCommonLetters(string1: String, string2: String): List<Char> {
/**
 * Given two strings, find the common letters and return a list.
 *
 * @param string1 The first input string.
 * @param string2 The second input string.
 * @return A list containing the common letters found.
 */
fun printCommonLetters(string1: String, string2: String): List<Char> {

    val commonLetters = mutableListOf<Char>()

    // Nested loop to iterate through each character of both strings
    for (char1 in string1) {
        for (char2 in string2) {
            // If the characters match and are not already in the commonLetters list
            if (char1 == char2 && char1 !in commonLetters) {
                commonLetters.add(char1)
            }
        }
    }

    // Sort and return the commonLetters list
    return commonLetters.sorted()
}