/**
 * This exercise requires finding the common characters between two strings using nested loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A string containing the common characters found in both strings.
 *
 * Example:
 * findCommonCharacters("interior", "designer") returns "ier"
 */
fun findCommonCharacters(string1: String, string2: String): String {

    var commonCharacters = ""

    // Traverse each character in string1
    for (char1 in string1) {
        // Check if the character is already in the common characters string
        if (char1 in commonCharacters) {
            continue
        }

        // Traverse each character in string2
        for (char2 in string2) {
            // If a common character is found, add it to the common characters string
            if (char1 == char2) {
                commonCharacters += char1
                break
            }
        }
    }

    return commonCharacters
}
/**
 * This exercise requires finding the common characters between two strings using nested loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A string containing the common characters found in both strings.
 *
 * Example:
 * findCommonCharacters("interior", "designer") returns "ier"
 */
fun findCommonCharacters(string1: String, string2: String): String {
/**
 * This exercise requires finding the common characters between two strings using nested loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A string containing the common characters found in both strings.
 *
 * Example:
 * findCommonCharacters("interior", "designer") returns "ier"
 */
fun findCommonCharacters(string1: String, string2: String): String {

    var commonCharacters = ""

    // Traverse each character in string1
    for (char1 in string1) {
        // Check if the character is already in the common characters string
        if (char1 in commonCharacters) {
            continue
        }

        // Traverse each character in string2
        for (char2 in string2) {
            // If a common character is found, add it to the common characters string
            if (char1 == char2) {
                commonCharacters += char1
                break
            }
        }
    }

    return commonCharacters
}