/**
 * Given two strings, find the characters that occur in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that occur in both strings.
 *
 * Example:
 * findIntersection("hello", "world") // ['l']
 * findIntersection("apple", "banana") // ['a']
 */
fun findIntersection(string1: String, string2: String): List<Char> {

    val intersection = mutableListOf<Char>()
    for (char1 in string1) {
        for (char2 in string2) {
            if (char1 == char2 && char1 !in intersection) {
                intersection.add(char1)
            }
        }
    }
    return intersection
}
/**
 * Given two strings, find the characters that occur in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that occur in both strings.
 *
 * Example:
 * findIntersection("hello", "world") // ['l']
 * findIntersection("apple", "banana") // ['a']
 */
fun findIntersection(string1: String, string2: String): List<Char> {
/**
 * Given two strings, find the characters that occur in both strings using loops.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list of characters that occur in both strings.
 *
 * Example:
 * findIntersection("hello", "world") // ['l']
 * findIntersection("apple", "banana") // ['a']
 */
fun findIntersection(string1: String, string2: String): List<Char> {

    val intersection = mutableListOf<Char>()
    for (char1 in string1) {
        for (char2 in string2) {
            if (char1 == char2 && char1 !in intersection) {
                intersection.add(char1)
            }
        }
    }
    return intersection
}