/**
 * This function takes two strings as input and finds the characters that are common in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that are common in both strings.
 *
 * Example:
 * findEqualChars("hello", "world") // ['o']
 * findEqualChars("racecar", "abrakadabra") // ['a', 'r']
 */
fun findEqualChars(string1: String, string2: String): List<Char> {

    // Initialize an empty list to store the common characters
    val commonChars = mutableListOf<Char>()

    // Iterate through each character in the first string
    for (char1 in string1) {
        // Iterate through each character in the second string
        for (char2 in string2) {
            // If the current characters are equal and not already in the commonChars list, add it
            if (char1 == char2 && char1 !in commonChars) {
                commonChars.add(char1)
            }
        }
    }

    // Return the list of common characters
    return commonChars
}
/**
 * This function takes two strings as input and finds the characters that are common in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that are common in both strings.
 *
 * Example:
 * findEqualChars("hello", "world") // ['o']
 * findEqualChars("racecar", "abrakadabra") // ['a', 'r']
 */
fun findEqualChars(string1: String, string2: String): List<Char> {
/**
 * This function takes two strings as input and finds the characters that are common in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that are common in both strings.
 *
 * Example:
 * findEqualChars("hello", "world") // ['o']
 * findEqualChars("racecar", "abrakadabra") // ['a', 'r']
 */
fun findEqualChars(string1: String, string2: String): List<Char> {

    // Initialize an empty list to store the common characters
    val commonChars = mutableListOf<Char>()

    // Iterate through each character in the first string
    for (char1 in string1) {
        // Iterate through each character in the second string
        for (char2 in string2) {
            // If the current characters are equal and not already in the commonChars list, add it
            if (char1 == char2 && char1 !in commonChars) {
                commonChars.add(char1)
            }
        }
    }

    // Return the list of common characters
    return commonChars
}