/**
 * This exercise requires the implementation of a function that finds the common characters between two strings.
 * The function should use a while loop and nested control flow to iterate through each character in the first string,
 * and then check if the character is present in the second string. The function should then return a string containing
 * all the common characters found.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A string containing the common characters found between the two input strings.
 */
fun findCommonCharacters(str1: String, str2: String): String {

    var commonChars = ""
    var i = 0
    while (i < str1.length) {
        var j = 0
        while (j < str2.length) {
            if (str1[i] == str2[j]) {
                commonChars += str1[i]
                break
            }
            j++
        }
        i++
    }
    return commonChars
}

// Example usage
/**
 * This exercise requires the implementation of a function that finds the common characters between two strings.
 * The function should use a while loop and nested control flow to iterate through each character in the first string,
 * and then check if the character is present in the second string. The function should then return a string containing
 * all the common characters found.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A string containing the common characters found between the two input strings.
 */
fun findCommonCharacters(str1: String, str2: String): String {
/**
 * This exercise requires the implementation of a function that finds the common characters between two strings.
 * The function should use a while loop and nested control flow to iterate through each character in the first string,
 * and then check if the character is present in the second string. The function should then return a string containing
 * all the common characters found.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A string containing the common characters found between the two input strings.
 */
fun findCommonCharacters(str1: String, str2: String): String {

    var commonChars = ""
    var i = 0
    while (i < str1.length) {
        var j = 0
        while (j < str2.length) {
            if (str1[i] == str2[j]) {
                commonChars += str1[i]
                break
            }
            j++
        }
        i++
    }
    return commonChars
}

// Example usage